Java Code Examples for net.minecraft.entity.passive.EntityAnimal#isInLove()
The following examples show how to use
net.minecraft.entity.passive.EntityAnimal#isInLove() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BreedModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Listener public void onUpdate(EventPlayerUpdate event) { if (event.getStage() == EventStageable.EventStage.PRE) { final Minecraft mc = Minecraft.getMinecraft(); for(Entity e : mc.world.loadedEntityList) { if(e != null && e instanceof EntityAnimal) { final EntityAnimal animal = (EntityAnimal) e; if(animal.getHealth() > 0) { if (!animal.isChild() && !animal.isInLove() && mc.player.getDistance(animal) <= 4.5f && animal.isBreedingItem(mc.player.inventory.getCurrentItem())) { mc.playerController.interactWithEntity(mc.player, animal, EnumHand.MAIN_HAND); } } } } } }
Example 2
Source File: ActivationRange.java From Kettle with GNU General Public License v3.0 | 5 votes |
/** * If an entity is not in range, do some more checks to see if we should * give it a shot. * * @param entity * @return */ public static boolean checkEntityImmunities(Entity entity) { // quick checks. if (entity.inWater || entity.fire > 0) { return true; } if (!(entity instanceof EntityArrow)) { if (!entity.onGround || !entity.riddenByEntities.isEmpty() || entity.isRiding()) { return true; } } else if (!((EntityArrow) entity).inGround) { return true; } // special cases. if (entity instanceof EntityLiving) { EntityLiving living = (EntityLiving) entity; if ( /*TODO: Missed mapping? living.attackTicks > 0 || */ living.hurtTime > 0 || living.activePotionsMap.size() > 0) { return true; } if (entity instanceof EntityCreature && ((EntityCreature) entity).getAttackTarget() != null) { return true; } if (entity instanceof EntityVillager && ((EntityVillager) entity).isMating()) { return true; } if (entity instanceof EntityAnimal) { EntityAnimal animal = (EntityAnimal) entity; if (animal.isChild() || animal.isInLove()) { return true; } if (entity instanceof EntitySheep && ((EntitySheep) entity).getSheared()) { return true; } } if (entity instanceof EntityCreeper && ((EntityCreeper) entity).hasIgnited()) { // isExplosive return true; } } return false; }
Example 3
Source File: ServerEventHandler.java From Et-Futurum with The Unlicense | 5 votes |
private void setAnimalInLove(EntityAnimal animal, EntityPlayer player, ItemStack stack) { if (!animal.isInLove()) { animal.func_146082_f(player); if (!player.capabilities.isCreativeMode) if (--stack.stackSize <= 0) player.inventory.setInventorySlotContents(player.inventory.currentItem, null); } }
Example 4
Source File: EntityFluidCow.java From Moo-Fluids with GNU General Public License v3.0 | 5 votes |
@Override public boolean canMateWith(EntityAnimal entityAnimal) { if (entityAnimal != this) { if (isInLove() && entityAnimal.isInLove()) { if (entityAnimal instanceof EntityFluidCow) { final Fluid mateEntityFluid = ((EntityFluidCow) entityAnimal).getEntityFluid(); if (getEntityFluid().getName().equals(mateEntityFluid.getName())) { return true; } } } } return false; }
Example 5
Source File: ActivationRange.java From Thermos with GNU General Public License v3.0 | 4 votes |
/** * If an entity is not in range, do some more checks to see if we should * give it a shot. * * @param entity * @return */ public static boolean checkEntityImmunities(Entity entity) { // quick checks. if ( entity.inWater /* isInWater */ || entity.fire > 0 ) { return true; } if ( !( entity instanceof EntityArrow ) ) { if ( !entity.onGround || entity.riddenByEntity != null || entity.ridingEntity != null ) { return true; } } else if ( !( (EntityArrow) entity ).inGround ) { return true; } // special cases. if ( entity instanceof EntityLiving ) { EntityLiving living = (EntityLiving) entity; if ( living.attackTime > 0 || living.hurtTime > 0 || living.activePotionsMap.size() > 0 ) { return true; } if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).entityToAttack != null ) { return true; } if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).isMating() /* Getter for first boolean */ ) { return true; } if ( entity instanceof EntityAnimal ) { EntityAnimal animal = (EntityAnimal) entity; if ( animal.isChild() || animal.isInLove() /*love*/ ) { return true; } if ( entity instanceof EntitySheep && ( (EntitySheep) entity ).getSheared() ) { return true; } } } return false; }
Example 6
Source File: UpgradeBreeding.java From BetterChests with GNU Lesser General Public License v3.0 | 4 votes |
private boolean isEntityOk(EntityAnimal entity) { return !entity.isDead && !entity.isInLove() && entity.getGrowingAge() == 0; }