當前位置: 首頁>>代碼示例>>Java>>正文


Java IEntityNoClipPet類代碼示例

本文整理匯總了Java中com.dsh105.echopet.compat.api.entity.IEntityNoClipPet的典型用法代碼示例。如果您正苦於以下問題:Java IEntityNoClipPet類的具體用法?Java IEntityNoClipPet怎麽用?Java IEntityNoClipPet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IEntityNoClipPet類屬於com.dsh105.echopet.compat.api.entity包,在下文中一共展示了IEntityNoClipPet類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ownerRidePet

import com.dsh105.echopet.compat.api.entity.IEntityNoClipPet; //導入依賴的package包/類
@Override
public void ownerRidePet(boolean flag) {
    if (this.ownerRiding == flag) {
        return;
    }

    this.ownerIsMounting = true;

    if (this.isHat) {
        this.setAsHat(false);
    }

    // Ew...This stuff is UGLY :c

    if (!flag) {
        INMS.getInstance().mount(this.getOwner(), null);
        //((CraftPlayer) this.getOwner()).getHandle().mount(null);
        if (this.getEntityPet() instanceof IEntityNoClipPet) {
            ((IEntityNoClipPet) this.getEntityPet()).noClip(true);
        }
        ownerIsMounting = false;
    } else {
        if (this.getRider() != null) {
            this.getRider().removePet(false);
        }
        new BukkitRunnable() {
            @Override
            public void run() {
                INMS.getInstance().mount(getOwner(), getEntityPet().getBukkitEntity());
                //((CraftPlayer) getOwner()).getHandle().mount(getEntityPet());
                ownerIsMounting = false;
                if (getEntityPet() instanceof IEntityNoClipPet) {
                    ((IEntityNoClipPet) getEntityPet()).noClip(false);
                }
            }
        }.runTaskLater(EchoPet.getPlugin(), 5L);
    }
    this.teleportToOwner();
    this.getEntityPet().resizeBoundingBox(flag);
    this.ownerRiding = flag;
    Particle.PORTAL.show(getLocation());
    Location l = this.getLocation().clone();
    l.setY(l.getY() - 1D);
    ParticleBuilder builder = Particle.BLOCK_DUST.builder();
    builder.setBlockType(l.getBlock().getType());
    builder.setPosition(getLocation());
    builder.show();
}
 
開發者ID:TechzoneMC,項目名稱:SonarPet,代碼行數:49,代碼來源:Pet.java


注:本文中的com.dsh105.echopet.compat.api.entity.IEntityNoClipPet類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。