Java 类net.minecraft.server.EntityInsentient 实例源码

项目:CraftBukkit    文件:CraftLivingEntity.java   
public void setCustomName(String name) {
    if (!(getHandle() instanceof EntityInsentient)) {
        return;
    }

    if (name == null) {
        name = "";
    }

    // Names cannot be more than 64 characters due to DataWatcher limitations
    if (name.length() > 64) {
        name = name.substring(0, 64);
    }

    ((EntityInsentient) getHandle()).setCustomName(name);
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public boolean setLeashHolder(Entity holder) {
    if ((getHandle() instanceof EntityWither) || !(getHandle() instanceof EntityInsentient)) {
        return false;
    }

    if (holder == null) {
        return unleash();
    }

    if (holder.isDead()) {
        return false;
    }

    unleash();
    ((EntityInsentient) getHandle()).setLeashHolder(((CraftEntity) holder).getHandle(), true);
    return true;
}
项目:Craftbukkit    文件:CraftLivingEntity.java   
public boolean setLeashHolder(Entity holder) {
    if ((getHandle() instanceof EntityWither) || !(getHandle() instanceof EntityInsentient)) {
        return false;
    }

    if (holder == null) {
        return unleash();
    }

    if (holder.isDead()) {
        return false;
    }

    unleash();
    ((EntityInsentient) getHandle()).setLeashHolder(((CraftEntity) holder).getHandle(), true);
    return true;
}
项目:Almura-Server    文件:CraftLivingEntity.java   
public void setCustomName(String name) {
    if (!(getHandle() instanceof EntityInsentient)) {
        return;
    }

    if (name == null) {
        name = "";
    }

    // Names cannot be more than 64 characters due to DataWatcher limitations
    if (name.length() > 64) {
        name = name.substring(0, 64);
    }

    ((EntityInsentient) getHandle()).setCustomName(name);
}
项目:Almura-Server    文件:CraftLivingEntity.java   
public boolean setLeashHolder(Entity holder) {
    if ((getHandle() instanceof EntityWither) || !(getHandle() instanceof EntityInsentient)) {
        return false;
    }

    if (holder == null) {
        return unleash();
    }

    if (holder.isDead()) {
        return false;
    }

    unleash();
    ((EntityInsentient) getHandle()).setLeashHolder(((CraftEntity) holder).getHandle(), true);
    return true;
}
项目:Tweakkit-Server    文件:CraftLivingEntity.java   
public void setCustomName(String name) {
    if (!(getHandle() instanceof EntityInsentient)) {
        return;
    }

    if (name == null) {
        name = "";
    }

    // Names cannot be more than 64 characters due to DataWatcher limitations
    if (name.length() > 64) {
        name = name.substring(0, 64);
    }

    ((EntityInsentient) getHandle()).setCustomName(name);
}
项目:Tweakkit-Server    文件:CraftLivingEntity.java   
public boolean setLeashHolder(Entity holder) {
    if ((getHandle() instanceof EntityWither) || !(getHandle() instanceof EntityInsentient)) {
        return false;
    }

    if (holder == null) {
        return unleash();
    }

    if (holder.isDead()) {
        return false;
    }

    unleash();
    ((EntityInsentient) getHandle()).setLeashHolder(((CraftEntity) holder).getHandle(), true);
    return true;
}
项目:CardinalPGM    文件:AllMobFilter.java   
@Override
public FilterState evaluate(final Object... objects) {
    boolean abstain = true;
    for (Object object : objects) {
        if (object instanceof Entity) {
            if (((CraftEntity)object).getHandle() instanceof EntityInsentient) {
                return allow ? FilterState.ALLOW : FilterState.DENY;
            }
            abstain = false;
        }
    }
    if (abstain) {
        return (getParent() == null ? ABSTAIN : getParent().evaluate(objects));
    }
    return allow ? FilterState.DENY : FilterState.ALLOW;
}
项目:SpigotSource    文件:CraftLivingEntity.java   
public boolean setLeashHolder(Entity holder) {
    if ((getHandle() instanceof EntityWither) || !(getHandle() instanceof EntityInsentient)) {
        return false;
    }

    if (holder == null) {
        return unleash();
    }

    if (holder.isDead()) {
        return false;
    }

    unleash();
    ((EntityInsentient) getHandle()).setLeashHolder(((CraftEntity) holder).getHandle(), true);
    return true;
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (entity instanceof EntityInsentient) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public String getCustomName() {
    if (!(getHandle() instanceof EntityInsentient)) {
        return null;
    }

    String name = ((EntityInsentient) getHandle()).getCustomName();

    if (name == null || name.length() == 0) {
        return null;
    }

    return name;
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
private boolean unleash() {
    if (!isLeashed()) {
        return false;
    }
    ((EntityInsentient) getHandle()).unleash(true, false);
    return true;
}
项目:CraftBukkit    文件:CraftEventFactory.java   
/**
 * EntityTameEvent
 */
public static EntityTameEvent callEntityTameEvent(EntityInsentient entity, EntityHuman tamer) {
    org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
    org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? tamer.getBukkitEntity() : null);
    CraftServer craftServer = (CraftServer) bukkitEntity.getServer();

    entity.persistent = true;

    EntityTameEvent event = new EntityTameEvent((LivingEntity) bukkitEntity, bukkitTamer);
    craftServer.getPluginManager().callEvent(event);
    return event;
}
项目:Craftbukkit    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (entity instanceof EntityInsentient || entity instanceof EntityArmorStand) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:Craftbukkit    文件:CraftLivingEntity.java   
private boolean unleash() {
    if (!isLeashed()) {
        return false;
    }
    ((EntityInsentient) getHandle()).unleash(true, false);
    return true;
}
项目:Almura-Server    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (entity instanceof EntityInsentient) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:Almura-Server    文件:CraftLivingEntity.java   
public String getCustomName() {
    if (!(getHandle() instanceof EntityInsentient)) {
        return null;
    }

    String name = ((EntityInsentient) getHandle()).getCustomName();

    if (name == null || name.length() == 0) {
        return null;
    }

    return name;
}
项目:Almura-Server    文件:CraftLivingEntity.java   
private boolean unleash() {
    if (!isLeashed()) {
        return false;
    }
    ((EntityInsentient) getHandle()).unleash(true, false);
    return true;
}
项目:Almura-Server    文件:CraftEventFactory.java   
/**
 * EntityTameEvent
 */
public static EntityTameEvent callEntityTameEvent(EntityInsentient entity, EntityHuman tamer) {
    org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
    org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? tamer.getBukkitEntity() : null);
    CraftServer craftServer = (CraftServer) bukkitEntity.getServer();

    entity.persistent = true;

    EntityTameEvent event = new EntityTameEvent((LivingEntity) bukkitEntity, bukkitTamer);
    craftServer.getPluginManager().callEvent(event);
    return event;
}
项目:Tweakkit-Server    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (entity instanceof EntityInsentient) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:Tweakkit-Server    文件:CraftLivingEntity.java   
public String getCustomName() {
    if (!(getHandle() instanceof EntityInsentient)) {
        return null;
    }

    String name = ((EntityInsentient) getHandle()).getCustomName();

    if (name == null || name.length() == 0) {
        return null;
    }

    return name;
}
项目:Tweakkit-Server    文件:CraftLivingEntity.java   
private boolean unleash() {
    if (!isLeashed()) {
        return false;
    }
    ((EntityInsentient) getHandle()).unleash(true, false);
    return true;
}
项目:Tweakkit-Server    文件:CraftEventFactory.java   
/**
 * EntityTameEvent
 */
public static EntityTameEvent callEntityTameEvent(EntityInsentient entity, EntityHuman tamer) {
    org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
    org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? tamer.getBukkitEntity() : null);
    CraftServer craftServer = (CraftServer) bukkitEntity.getServer();

    entity.persistent = true;

    EntityTameEvent event = new EntityTameEvent((LivingEntity) bukkitEntity, bukkitTamer);
    craftServer.getPluginManager().callEvent(event);
    return event;
}
项目:CardinalPGM    文件:MobFilter.java   
@Override
public FilterState evaluate(Object... objects) {
    for (Object object : objects) {
        if (object instanceof Entity) {
            if (((CraftEntity)object).getHandle() instanceof EntityInsentient && mobType.equals(((CraftEntity) object).getType()))
                return ALLOW;
            else
                return DENY;
        }
    }
    return (getParent() == null ? ABSTAIN : getParent().evaluate(objects));
}
项目:SpigotSource    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (entity instanceof EntityInsentient || entity instanceof EntityArmorStand) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:SpigotSource    文件:CraftLivingEntity.java   
private boolean unleash() {
    if (!isLeashed()) {
        return false;
    }
    ((EntityInsentient) getHandle()).unleash(true, false);
    return true;
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
private void setDropChance(EnumItemSlot slot, float chance) {
    if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
        ((EntityInsentient) entity.getHandle()).dropChanceHand[slot.b()] = chance - 0.1F;
    } else {
        ((EntityInsentient) entity.getHandle()).dropChanceArmor[slot.b()] = chance - 0.1F;
    }
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
private float getDropChance(EnumItemSlot slot) {
    if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
        return ((EntityInsentient) entity.getHandle()).dropChanceHand[slot.b()] + 0.1F;
    } else {
        return ((EntityInsentient) entity.getHandle()).dropChanceArmor[slot.b()] + 0.1F;
    }
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public boolean getRemoveWhenFarAway() {
    return getHandle() instanceof EntityInsentient && !((EntityInsentient) getHandle()).persistent;
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public void setRemoveWhenFarAway(boolean remove) {
    if (getHandle() instanceof EntityInsentient) {
        ((EntityInsentient) getHandle()).persistent = !remove;
    }
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public void setCanPickupItems(boolean pickup) {
    if (getHandle() instanceof EntityInsentient) {
        ((EntityInsentient) getHandle()).canPickUpLoot = pickup;
    }
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public boolean getCanPickupItems() {
    return getHandle() instanceof EntityInsentient && ((EntityInsentient) getHandle()).canPickUpLoot;
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public void setCustomNameVisible(boolean flag) {
    if (getHandle() instanceof EntityInsentient) {
        ((EntityInsentient) getHandle()).setCustomNameVisible(flag);
    }
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public boolean isCustomNameVisible() {
    return getHandle() instanceof EntityInsentient && ((EntityInsentient) getHandle()).getCustomNameVisible();
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public boolean isLeashed() {
    if (!(getHandle() instanceof EntityInsentient)) {
        return false;
    }
    return ((EntityInsentient) getHandle()).getLeashHolder() != null;
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public Entity getLeashHolder() throws IllegalStateException {
    if (!isLeashed()) {
        throw new IllegalStateException("Entity not leashed");
    }
    return ((EntityInsentient) getHandle()).getLeashHolder().getBukkitEntity();
}
项目:CraftBukkit    文件:CraftEntityEquipment.java   
private void setDropChance(int slot, float chance) {
    ((EntityInsentient) entity.getHandle()).dropChances[slot] = chance - 0.1F;
}
项目:CraftBukkit    文件:CraftEntityEquipment.java   
private float getDropChance(int slot) {
    return ((EntityInsentient) entity.getHandle()).dropChances[slot] + 0.1F;
}
项目:CraftBukkit    文件:CraftEventFactory.java   
public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(EntityInsentient entity, EntityHuman player) {
    PlayerUnleashEntityEvent event = new PlayerUnleashEntityEvent(entity.getBukkitEntity(), (Player) player.getBukkitEntity());
    entity.world.getServer().getPluginManager().callEvent(event);
    return event;
}
项目:CraftBukkit    文件:CraftEventFactory.java   
public static PlayerLeashEntityEvent callPlayerLeashEntityEvent(EntityInsentient entity, Entity leashHolder, EntityHuman player) {
    PlayerLeashEntityEvent event = new PlayerLeashEntityEvent(entity.getBukkitEntity(), leashHolder.getBukkitEntity(), (Player) player.getBukkitEntity());
    entity.world.getServer().getPluginManager().callEvent(event);
    return event;
}