Java 类net.minecraft.entity.passive.EntityAnimal 实例源码

项目:Etheric    文件:InfertilityEvent.java   
@Override
public void affectChunk(World world) {

    Chunk chunk = world.getChunkFromChunkCoords(chunkPos.x, chunkPos.z);

    for (int i = 0; i < chunk.getEntityLists().length; i++) {
        if (chunk.getEntityLists()[i] != null) {
            for (EntityAnimal e : chunk.getEntityLists()[i].getByClass(EntityAnimal.class)) {
                if (world.rand.nextInt(3) == 0) {
                    e.addTag(TAG);
                }
            }
        }
    }

}
项目:DecompiledMinecraft    文件:EntityAIMate.java   
/**
 * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first
 * valid mate found.
 */
private EntityAnimal getNearbyMate()
{
    float f = 8.0F;
    List<EntityAnimal> list = this.theWorld.<EntityAnimal>getEntitiesWithinAABB(this.theAnimal.getClass(), this.theAnimal.getEntityBoundingBox().expand((double)f, (double)f, (double)f));
    double d0 = Double.MAX_VALUE;
    EntityAnimal entityanimal = null;

    for (EntityAnimal entityanimal1 : list)
    {
        if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0)
        {
            entityanimal = entityanimal1;
            d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1);
        }
    }

    return entityanimal;
}
项目:DecompiledMinecraft    文件:EntityAIMate.java   
/**
 * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first
 * valid mate found.
 */
private EntityAnimal getNearbyMate()
{
    float f = 8.0F;
    List<EntityAnimal> list = this.theWorld.<EntityAnimal>getEntitiesWithinAABB(this.theAnimal.getClass(), this.theAnimal.getEntityBoundingBox().expand((double)f, (double)f, (double)f));
    double d0 = Double.MAX_VALUE;
    EntityAnimal entityanimal = null;

    for (EntityAnimal entityanimal1 : list)
    {
        if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0)
        {
            entityanimal = entityanimal1;
            d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1);
        }
    }

    return entityanimal;
}
项目:BaseClient    文件:Aura.java   
private boolean checkValidity(final EntityLivingBase entity) {
    if (entity == this.mc.thePlayer) {
        return false;
    }
    if (!entity.isEntityAlive()) {
        return false;
    }
    if (this.mc.thePlayer.getDistanceToEntity(entity) > this.range) {
        return false;
    }
    if (!(entity instanceof EntityPlayer)) {
        return (this.monsters && entity instanceof EntityMob) || (this.animals && (entity instanceof EntityAnimal || entity instanceof EntitySquid)) || (this.bats && entity instanceof EntityBat);
    }
    if (this.players) {
        final EntityPlayer player = (EntityPlayer)entity;
        return (this.friend && FriendManager.isFriend(player.getName())) || (!FriendManager.isFriend(player.getName()) && (!this.noArmor || this.hasArmor(player)));
    }
    return false;
}
项目:BaseClient    文件:EntityAIMate.java   
/**
 * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first
 * valid mate found.
 */
private EntityAnimal getNearbyMate()
{
    float f = 8.0F;
    List<EntityAnimal> list = this.theWorld.<EntityAnimal>getEntitiesWithinAABB(this.theAnimal.getClass(), this.theAnimal.getEntityBoundingBox().expand((double)f, (double)f, (double)f));
    double d0 = Double.MAX_VALUE;
    EntityAnimal entityanimal = null;

    for (EntityAnimal entityanimal1 : list)
    {
        if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0)
        {
            entityanimal = entityanimal1;
            d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1);
        }
    }

    return entityanimal;
}
项目:BaseClient    文件:EntityAIMate.java   
/**
 * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first
 * valid mate found.
 */
private EntityAnimal getNearbyMate()
{
    float f = 8.0F;
    List<EntityAnimal> list = this.theWorld.<EntityAnimal>getEntitiesWithinAABB(this.theAnimal.getClass(), this.theAnimal.getEntityBoundingBox().expand((double)f, (double)f, (double)f));
    double d0 = Double.MAX_VALUE;
    EntityAnimal entityanimal = null;

    for (EntityAnimal entityanimal1 : list)
    {
        if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0)
        {
            entityanimal = entityanimal1;
            d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1);
        }
    }

    return entityanimal;
}
项目:connor41-etfuturum2    文件:ServerEventHandler.java   
@SubscribeEvent
public void interactEntityEvent(EntityInteractEvent event) {
    ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
    if (stack == null)
        return;
    if (!(event.target instanceof EntityAnimal))
        return;

    EntityAnimal animal = (EntityAnimal) event.target;
    if (!animal.isChild()) {
        if (animal instanceof EntityPig) {
            if (stack.getItem() == ModItems.beetroot && EtFuturum.enableBeetroot)
                setAnimalInLove(animal, event.entityPlayer, stack);
        } else if (animal instanceof EntityChicken)
            if (stack.getItem() == ModItems.beetroot_seeds && EtFuturum.enableBeetroot)
                setAnimalInLove(animal, event.entityPlayer, stack);
    } else if (EtFuturum.enableBabyGrowthBoost && isFoodItem(animal, stack))
        feedBaby(animal, event.entityPlayer, stack);
}
项目:connor41-etfuturum2    文件:ServerEventHandler.java   
private void feedBaby(EntityAnimal animal, EntityPlayer player, ItemStack stack) {
    int currentAge = animal.getGrowingAge();
    int age = (int) (-currentAge * 0.1F);
    animal.setGrowingAge(currentAge + age);
    player.swingItem();

    Random itemRand = animal.worldObj.rand;
    for (int i = 0; i < 3; i++) {
        double d0 = itemRand.nextGaussian() * 0.02D;
        double d1 = itemRand.nextGaussian() * 0.02D;
        double d2 = itemRand.nextGaussian() * 0.02D;
        animal.worldObj.spawnParticle("happyVillager", animal.posX + itemRand.nextFloat() * 0.5, animal.posY + 0.5 + itemRand.nextFloat() * 0.5, animal.posZ + itemRand.nextFloat() * 0.5, d0, d1, d2);
    }

    if (!player.capabilities.isCreativeMode)
        if (--stack.stackSize <= 0)
            player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
项目:EMC    文件:IEntity.java   
public Color getEntityColor() {
    if ((entity instanceof EntityAnimal)) {
        return Color.white;
    }
    if ((entity instanceof EntityMob)) {
        return Color.red;
    }
    if ((entity instanceof EntitySlime)) {
        return Color.green;
    }
    if ((entity instanceof EntityVillager)) {
        return new Color(245, 245, 220);
    }
    if ((entity instanceof EntityBat)) {
        return Color.BLACK;
    }
    if ((entity instanceof EntitySquid)) {
        return Color.PINK;
    }
    return Color.white;
}
项目:Backmemed    文件:EntityAIMate.java   
/**
 * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first
 * valid mate found.
 */
private EntityAnimal getNearbyMate()
{
    List<EntityAnimal> list = this.theWorld.<EntityAnimal>getEntitiesWithinAABB(this.field_190857_e, this.theAnimal.getEntityBoundingBox().expandXyz(8.0D));
    double d0 = Double.MAX_VALUE;
    EntityAnimal entityanimal = null;

    for (EntityAnimal entityanimal1 : list)
    {
        if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0)
        {
            entityanimal = entityanimal1;
            d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1);
        }
    }

    return entityanimal;
}
项目:CustomWorldGen    文件:BabyEntitySpawnEvent.java   
public BabyEntitySpawnEvent(EntityLiving parentA, EntityLiving parentB, @Nullable EntityAgeable proposedChild)
{
    //causedByPlayer calculated here to simplify the patch.
    EntityPlayer causedByPlayer = null;
    if (parentA instanceof EntityAnimal) {
        causedByPlayer = ((EntityAnimal)parentA).getPlayerInLove();
    }

    if (causedByPlayer == null && parentB instanceof EntityAnimal)
    {
        causedByPlayer = ((EntityAnimal)parentB).getPlayerInLove();
    }

    this.parentA = parentA;
    this.parentB = parentB;
    this.causedByPlayer = causedByPlayer;
    this.child = proposedChild;
}
项目:CustomWorldGen    文件:EntityAIMate.java   
/**
 * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first
 * valid mate found.
 */
private EntityAnimal getNearbyMate()
{
    List<EntityAnimal> list = this.theWorld.<EntityAnimal>getEntitiesWithinAABB(this.theAnimal.getClass(), this.theAnimal.getEntityBoundingBox().expandXyz(8.0D));
    double d0 = Double.MAX_VALUE;
    EntityAnimal entityanimal = null;

    for (EntityAnimal entityanimal1 : list)
    {
        if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0)
        {
            entityanimal = entityanimal1;
            d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1);
        }
    }

    return entityanimal;
}
项目:ExtraUtilities    文件:BlockPureLove.java   
public void onEntityCollidedWithBlock(final World world, final int x, final int y, final int z, final Entity entity) {
    if (this.rand.nextInt(5) > 0) {
        return;
    }
    if (entity instanceof EntityAnimal) {
        final EntityAnimal animal = (EntityAnimal)entity;
        if (animal.getGrowingAge() < 0) {
            animal.addGrowth(this.rand.nextInt(40));
        }
        else if (animal.getGrowingAge() > 0) {
            int j = animal.getGrowingAge();
            j -= this.rand.nextInt(40);
            if (j < 0) {
                j = 0;
            }
            animal.setGrowingAge(j);
        }
        else if (!animal.isInLove()) {
            if (world.getEntitiesWithinAABB((Class)entity.getClass(), entity.boundingBox.expand(8.0, 8.0, 8.0)).size() > 32) {
                return;
            }
            animal.func_146082_f((EntityPlayer)null);
        }
    }
}
项目:4Space-5    文件:EntitySlimeling.java   
@Override
public boolean canMateWith(EntityAnimal par1EntityAnimal)
{
    if (par1EntityAnimal == this)
    {
        return false;
    }
    else if (!this.isTamed())
    {
        return false;
    }
    else if (!(par1EntityAnimal instanceof EntitySlimeling))
    {
        return false;
    }
    else
    {
        EntitySlimeling slimeling = (EntitySlimeling) par1EntityAnimal;
        return slimeling.isTamed() && !slimeling.isSitting() && this.isInLove() && slimeling.isInLove();
    }
}
项目:CrystalMod    文件:MinionAICombat.java   
public boolean isEntityValidToAttack(EntityMinionWarrior minion, EntityLivingBase entity)
{
    if(entity == minion || entity == minion.getRidingEntity() || !EntityAITarget.isSuitableTarget(minion, entity, false, false) || entity.getClass() == EntityCreeper.class) return false;

    if (entity instanceof EntityMob &&
            (getTargetBehavior() == EnumCombatBehaviors.TARGET_HOSTILE_MOBS || 
            getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
    {
        return true;
    }

    else if (entity instanceof EntityAnimal &&
            (getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_MOBS || 
            getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
    {
        return true;
    }

    else
    {
        return false;
    }
}
项目:CrystalMod    文件:WorksiteAnimalFarm.java   
private boolean tryBreeding(List<EntityPair> targets) {
    Entity animalA;
    Entity animalB;
    EntityPair pair;
    if (!targets.isEmpty()) {
        pair = targets.remove(0);
        animalA = pair.getEntityA(getWorld());
        animalB = pair.getEntityB(getWorld());
        if (!(animalA instanceof EntityAnimal)
                || !(animalB instanceof EntityAnimal)) {
            return false;
        }
        if (!hasBreedingItem((EntityAnimal) animalA))
            return false;
        ((EntityAnimal) animalA).setInLove(null);// setInLove(EntityPlayer
                                                        // breeder)
        ((EntityAnimal) animalB).setInLove(null);// setInLove(EntityPlayer
                                                        // breeder)
        return true;
    }
    return false;
}
项目:MidgarCrusade    文件:EntityStymph.java   
/**
 * Returns true if the mob is currently able to mate with the specified mob.
 */
public boolean canMateWith(EntityAnimal p_70878_1_)
{
    if (p_70878_1_ == this)
    {
        return false;
    }
    else if (!this.isTamed())
    {
        return false;
    }
    else if (!(p_70878_1_ instanceof EntityStymph))
    {
        return false;
    }
    else
    {
        EntityStymph entityocelot = (EntityStymph)p_70878_1_;
        return !entityocelot.isTamed() ? false : this.isInLove() && entityocelot.isInLove();
    }
}
项目:Rival-Rebels-Mod    文件:TileEntityReciever.java   
private boolean isValidTarget(Entity e)
{
    if (e == null) return false;
    else if (e instanceof EntityPlayer)
    {
        EntityPlayer p = ((EntityPlayer) e);
        if (p.capabilities.isCreativeMode) return false;
        else
        {
            if (kPlayers) return true;
            else if (!kTeam) return false;
            RivalRebelsPlayer rrp = RivalRebels.round.rrplayerlist.getForName(((EntityPlayer) e).getCommandSenderName());
            if (rrp == null) return kTeam;
            if (rrp.rrteam == RivalRebelsTeam.NONE) return !p.getCommandSenderName().equals(username);
            if (rrp.rrteam != team) return kTeam;
            else return false;
        }
    }
    else return (kMobs && (e instanceof EntityRhodes || (e instanceof EntityMob && !(e instanceof EntityAnimal) && !(e instanceof EntityBat) && !(e instanceof EntityVillager) && !(e instanceof EntitySquid)) || e instanceof EntityGhast));
}
项目:ToroQuest    文件:CivilizationHandlers.java   
@SubscribeEvent
public void breed(BabyEntitySpawnEvent event) {
    if (!ToroQuestConfiguration.animalsAffectRep) {
        return;
    }
    if (!(event.getParentA() instanceof EntityAnimal)) {
        return;
    }

    if (!(event.getParentB() instanceof EntityAnimal)) {
        return;
    }

    EntityPlayer playerA = ((EntityAnimal) event.getParentA()).getLoveCause();
    EntityPlayer playerB = ((EntityAnimal) event.getParentB()).getLoveCause();

    if (playerA != null) {
        adjustPlayerRep(playerA, event.getParentA().chunkCoordX, event.getParentA().chunkCoordZ, 1);
    }

    if (playerB != null) {
        adjustPlayerRep(playerB, event.getParentB().chunkCoordX, event.getParentB().chunkCoordZ, 1);
    }
}
项目:EssentialFeatures    文件:EntityPanda.java   
/**
 * Returns true if the mob is currently able to mate with the specified mob.
 */
public boolean canMateWith(EntityAnimal otherAnimal)
{
    if (otherAnimal == this)
    {
        return false;
    }
    else if (!this.isTamed())
    {
        return false;
    }
    else if (!(otherAnimal instanceof EntityPanda))
    {
        return false;
    }
    else
    {
        EntityPanda panda = (EntityPanda)otherAnimal;
        return !panda.isTamed() ? false : (panda.isSitting() ? false : this.isInLove() && panda.isInLove());
    }
}
项目:Mekfarm    文件:AnimalGymEntity.java   
private boolean packageCurrent() {
    EntityAnimal ea = this.getCurrent();
    if (ea == null) {
        return false;
    }

    ItemStack remaining = ItemHandlerHelper.insertItem(this.outStackHandler,
            AnimalFarmEntity.packageAnimal(null, ea),
            false);
    if (ItemStackUtil.isEmpty(remaining)) {
        this.currentAnimal = null;
        this.forceSync();
        this.markDirty();
        return true;
    }
    return false;
}
项目:Mekfarm    文件:AnimalWrapperFactory.java   
/**
 * @param entity
 * the entity to be wrapped
 * @return
 * return a nicely wrapped entity ready to be exploited in many many ways
 */
public static IAnimalWrapper getAnimalWrapper(EntityAnimal entity) {
    IAnimalWrapper wrapper = null;

    if (entity instanceof EntityHorse) {
        wrapper = new VanillaHorse((EntityHorse) entity);
    }

    if ((entity instanceof EntityCow) && entity.getClass().getName().equals("com.robrit.moofluids.common.entity.EntityFluidCow")) {
        wrapper = new MooFluidCow((EntityCow)entity);
    }

    if (wrapper == null) {
        wrapper = new VanillaGenericAnimal(entity);
    }
    return wrapper;
}
项目:ToroHealth    文件:AbstractHealthDisplay.java   
protected Relation determineRelation() {
    if (entity instanceof EntityMob) {
        return Relation.FOE;
    } else if (entity instanceof EntitySlime) {
        return Relation.FOE;
    } else if (entity instanceof EntityGhast) {
        return Relation.FOE;
    } else if (entity instanceof EntityAnimal) {
        return Relation.FRIEND;
    } else if (entity instanceof EntitySquid) {
        return Relation.FRIEND;
    } else if (entity instanceof EntityAmbientCreature) {
        return Relation.FRIEND;
    } else {
        return Relation.UNKNOWN;
    }
}
项目:Tannery    文件:EntityDropsHandler.java   
@SubscribeEvent
public void onLivingDrops(LivingDropsEvent event)
{
    Entity e = event.entity;
    List<EntityItem> drops = event.drops;
    // Remove all drops from cows, sheep and pigs, add carcass drop
    if (e instanceof EntityCow || e instanceof EntityPig || e instanceof EntitySheep)
    {
        EntityAnimal a = (EntityAnimal) e;
        Iterator<EntityItem> it = drops.iterator();
        while (it.hasNext())
        {
            EntityItem i = it.next();
            it.remove();
        }

        if (a.getGrowingAge() == 0)
        {
            if (a instanceof EntityCow) a.dropItem(TanneryItems.bloodyCowCarcass, 1);
            else if (a instanceof EntityPig) a.dropItem(TanneryItems.bloodyPigCarcass, 1);
            else if (a instanceof EntitySheep) a.dropItem(TanneryItems.bloodySheepCarcass, 1);
        }
    }
}
项目:geomastery    文件:EntityEvents.java   
/** Reduces animal spawns by half. */
@SubscribeEvent
public void checkSpawn(CheckSpawn event) {

    EntityLivingBase entity  = event.getEntityLiving();
    boolean canSpawn = true;

    if (entity instanceof EntityAnimal) {

        if (entity.world.rand.nextInt(2) == 0) {

            canSpawn = false;
        }
    }

    event.setResult(canSpawn ? Result.DEFAULT : Result.DENY);
}
项目:MobHunter    文件:EntityGiaprey.java   
public EntityGiaprey(World worldIn)
{
    super(worldIn, 1, 1);
    this.setSize(1.5F, 1.8125F);
    setBaseHealth(11);
    setBaseAttack(2);
    setBaseSpeed(0.3);
    setBaseKnockback(0.1);
    this.tasks.addTask(1, new EntityAILeapAtTarget(this,0.5f));
    this.tasks.addTask( 4, new EntityAIAttackMeleeAndSpit(this, 1.0D, 200, 16.0f,4.0f, true));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityAnimal.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWitch.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMHHerbivore.class, true));
}
项目:MobHunter    文件:EntityGendrome.java   
public EntityGendrome(World worldIn) {
    super(worldIn, Config.scaleMin*0.75f, Config.scaleMax*0.75f);
    this.setSize(2.25F, 2.5F);
    setBaseHealth(300);
    setBaseAttack(2*1.5);
    setBaseSpeed(0.3*1.5);
    setBaseKnockback(0.5*1.5);
    this.tasks.addTask(1, new EntityAILeapAtTarget(this,0.5f));
    this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityAnimal.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWitch.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMHHerbivore.class, true));
}
项目:MobHunter    文件:EntityJaggia.java   
public EntityJaggia(World worldIn)
{
    super(worldIn, 1, 1, Items.FISH);
    this.setSize(1.5F, 1.8125F);
    setBaseHealth(12);
    setBaseAttack(2);
    setBaseSpeed(0.3);
    setBaseKnockback(0.1);
    this.tasks.addTask(1, new EntityAILeapAtTarget(this,0.5f));
    this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityAnimal.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWitch.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMHHerbivore.class, true));
}
项目:MobHunter    文件:EntityGenprey.java   
public EntityGenprey(World worldIn)
{
    super(worldIn, 1, 1);
    this.setSize(1.5F, 1.8125F);
    setBaseHealth(12);
    setBaseAttack(2);
    setBaseSpeed(0.3);
    setBaseKnockback(0.1);
    this.tasks.addTask(1, new EntityAILeapAtTarget(this,0.5f));
    this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityAnimal.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWitch.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMHHerbivore.class, true));
}
项目:MobHunter    文件:EntityVelocidrome.java   
public EntityVelocidrome(World worldIn)
{
    super(worldIn, Config.scaleMin*0.75f, Config.scaleMax*0.75f);
    this.setSize(2.25F, 2.5F);
    setBaseHealth(300);
    setBaseAttack(2*1.5);
    setBaseSpeed(0.3*1.5);
    setBaseKnockback(0.5*1.5);
    this.tasks.addTask(1, new EntityAILeapAtTarget(this,0.5f));
    this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityAnimal.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWitch.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMHHerbivore.class, true));
}
项目:MobHunter    文件:EntityIoprey.java   
public EntityIoprey(World worldIn)
{
    super(worldIn, 1, 1);
    this.setSize(1.5F, 1.8125F);
    setBaseHealth(15);
    setBaseAttack(2);
    setBaseSpeed(0.3);
    setBaseKnockback(0.1);
    this.tasks.addTask(1, new EntityAILeapAtTarget(this,0.5f));
    this.tasks.addTask( 4, new EntityAIAttackMeleeAndSpit(this, 1.0D, 200, 16.0f,4.0f, true));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityAnimal.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWitch.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMHHerbivore.class, true));
}
项目:MobHunter    文件:EntityGreatJaggi.java   
public EntityGreatJaggi(World worldIn)
{
    super(worldIn, Config.scaleMin*0.75f, Config.scaleMax*0.75f);
    this.setSize(2.25F, 2.5F);
    setBaseHealth(390);
    setBaseAttack(2*1.5);
    setBaseSpeed(0.3*1.5);
    setBaseKnockback(0.5*1.5);
    this.tasks.addTask(1, new EntityAILeapAtTarget(this,0.5f));
    this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityAnimal.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWitch.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMHHerbivore.class, true));
}
项目:MobHunter    文件:EntityVelociprey.java   
public EntityVelociprey(World worldIn)
{
    super(worldIn, 1,1);
    this.setSize(1.5F, 1.8125F);
    setBaseHealth(10);
    setBaseAttack(2);
    setBaseSpeed(0.3);
    setBaseKnockback(0.1);
    this.tasks.addTask(1, new EntityAILeapAtTarget(this,0.5f));
    this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityAnimal.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWitch.class, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMHHerbivore.class, true));
}
项目:equidcraft    文件:EntityHorseCustom.java   
public boolean canMateWith(EntityAnimal otherAnimal)
{
    if (otherAnimal == this)
    {
        return false;
    }
    else if (otherAnimal.getClass() != this.getClass())
    {
        return false;
    }
    else
    {
        EntityHorseCustom entityhorse = (EntityHorseCustom) otherAnimal;

        if (this.canMate() && entityhorse.canMate())
        {
            HorseType horsetype = this.getType();
            HorseType horsetype1 = entityhorse.getType();
            return this.isMale() != entityhorse.isMale() && !this.isSterile() && !entityhorse.isSterile() && (horsetype == horsetype1 || horsetype == HorseType.HORSE && horsetype1 == HorseType.DONKEY || horsetype == HorseType.DONKEY && horsetype1 == HorseType.HORSE);
        }
        else
        {
            return false;
        }
    }
}
项目:equidcraft    文件:EntityAIMateCustom.java   
/**
 * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first
 * valid mate found.
 */
private EntityAnimal getNearbyMate()
{
    List<EntityAnimal> list = this.theWorld.<EntityAnimal>getEntitiesWithinAABB(this.theAnimal.getClass(), this.theAnimal.getEntityBoundingBox().expandXyz(8.0D));
    double d0 = Double.MAX_VALUE;
    EntityAnimal entityanimal = null;

    for (EntityAnimal entityanimal1 : list)
    {
        if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0)
        {
            entityanimal = entityanimal1;
            d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1);
        }
    }

    return entityanimal;
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityPopo.java   
private int func_90014_a(EntityAnimal p_90014_1_, EntityAnimal p_90014_2_)
{
    int i = this.func_90013_b(p_90014_1_);
    int j = this.func_90013_b(p_90014_2_);
    this.field_90016_e.getStackInSlot(0).setItemDamage(i);
    this.field_90016_e.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.field_90016_e, ((EntityPopo)p_90014_1_).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getItemDamage();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return k;
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityKitty.java   
/**
 * Returns true if the mob is currently able to mate with the specified mob.
 */
public boolean canMateWith(EntityAnimal p_70878_1_)
{
    if (p_70878_1_ == this)
    {
        return false;
    }
    else if (!this.isTamed())
    {
        return false;
    }
    else if (!(p_70878_1_ instanceof EntityKitty))
    {
        return false;
    }
    else
    {
        EntityKitty entitykitty = (EntityKitty)p_70878_1_;
        return !entitykitty.isTamed() ? false : this.isInLove() && entitykitty.isInLove();
    }
}
项目:ThermalRecycling    文件:BreedingItemRegistry.java   
private static Class<? extends EntityAnimal> resolveClass(final String entityClass) {

    if(!MineTweakerUtil.checkNotNull(entityClass, "Entity class name cannot be null"))
        return null;

    if(!MineTweakerUtil.checkArgument(!entityClass.isEmpty(), "Entity class name is invalid"))
        return null;

    final Class<?> clazz = (Class<?>) EntityList.stringToClassMapping.get(entityClass);
    if(!MineTweakerUtil.checkNotNull(clazz, String.format("Unknown entity type '%s'", entityClass)))
        return null;

    if(!MineTweakerUtil.checkArgument(!clazz.isAssignableFrom(EntityHorse.class), "Unable to specify breeding items for horses"))
        return null;

    final Class<? extends EntityAnimal> animal = clazz.asSubclass(EntityAnimal.class);
    if(!MineTweakerUtil.checkNotNull(animal, "Entity is not an EntityAnimal type"))
        return null;

    return animal;
}
项目:ThermalRecycling    文件:BreedingItemManager.java   
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = false)
public void entityInteract(final EntityInteractEvent event) {
    if(event.entityPlayer instanceof EntityPlayerMP && event.target instanceof EntityAnimal) {
        final EntityPlayerMP player = (EntityPlayerMP)event.entityPlayer;
        final ItemStack heldItem = player.getCurrentEquippedItem();
        if(heldItem != null) {
            final EntityAnimal animal = (EntityAnimal)event.target;
            if(canBreed(animal, player)) {
                final Set<ItemStackKey> possibleFood = foodItems.get(event.target.getClass());
                if(possibleFood != null && possibleFood.contains(ItemStackKey.getCachedKey(heldItem))) {
                    if (!event.entityPlayer.capabilities.isCreativeMode) {
                        heldItem.stackSize--;
                        if (heldItem.stackSize <= 0)
                            player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
                    }
                    animal.func_146082_f(player);
                }
            }
        }
    }
}
项目:Skills    文件:CombatBase.java   
public float getParrySkill(Entity target)
{
    if(target instanceof EntityPlayer)
    {
        SkillTreeBase parry = SkillTrackerData.get((EntityPlayer) target).GetSkillByID("parry");
        return parry != null ? parry.getSkillLevel() : 0;
    }
    else if (target instanceof EntityMob)
    {
        //TODO Give Mobs a Defense
        return EntityMobsExt.get((EntityMob)target).parry;
    }
    else if(target instanceof EntityAnimal)
    {
        return EntityAnimalExt.get((EntityAnimal)target).parry;
    }

    return 0;
}