net.minecraft.entity.EntityAgeable Java Examples
The following examples show how to use
net.minecraft.entity.EntityAgeable.
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: ProgWidgetEntityRightClick.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
@Override public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){ return new DroneEntityBase<IProgWidget, EntityLivingBase>(drone, widget){ private final List<Entity> visitedEntities = new ArrayList<Entity>(); @Override protected boolean isEntityValid(Entity entity){ return entity instanceof EntityLivingBase && !visitedEntities.contains(entity); } @Override protected boolean doAction(){ visitedEntities.add(targetedEntity); boolean activated = false; ItemStack stack = drone.getInventory().getStackInSlot(0); if(stack != null && stack.getItem().itemInteractionForEntity(stack, drone.getFakePlayer(), targetedEntity)) { activated = true; } if(!activated && targetedEntity instanceof EntityAgeable && ((EntityAgeable)targetedEntity).interact(drone.getFakePlayer())) { activated = true; } DroneAIBlockInteract.transferToDroneFromFakePlayer(drone); return false;//return activated; <-- will right click as long as it's sucessfully activated. } }; }
Example #2
Source File: EntityDeer.java From Sakura_mod with MIT License | 5 votes |
@Nullable @Override public EntityDeer createChild(EntityAgeable ageable) { EntityDeer entityDeer = new EntityDeer(this.world); return entityDeer; }
Example #3
Source File: PneumaticCraftUtils.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private static boolean isEntityValidForModifier(String modifier, String value, Entity entity) throws IllegalArgumentException{ if(modifier.equalsIgnoreCase("age")) { if(entity instanceof EntityAgeable) { if(value.equalsIgnoreCase("adult")) { return ((EntityAgeable)entity).getGrowingAge() >= 0; } else if(value.equalsIgnoreCase("baby")) { return ((EntityAgeable)entity).getGrowingAge() < 0; } else { throw new IllegalArgumentException(value + " doesn't match 'adult'/'baby'."); } } else { throw new IllegalArgumentException("This modifier can't be applied to this entity."); } } else if(modifier.equalsIgnoreCase("breedable")) { if(entity instanceof EntityAgeable) { if(value.equalsIgnoreCase("yes")) { return ((EntityAgeable)entity).getGrowingAge() == 0; } else if(value.equalsIgnoreCase("no")) { return ((EntityAgeable)entity).getGrowingAge() != 0; } else { throw new IllegalArgumentException(value + " doesn't match 'yes'/'no'."); } } else { throw new IllegalArgumentException("This modifier can't be applied to this entity."); } } throw new IllegalArgumentException(modifier + " is not a valid modifier"); }
Example #4
Source File: EntityTrackHandler.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void addInfo(Entity entity, List<String> curInfo){ int growingAge = ((EntityAgeable)entity).getGrowingAge(); if(growingAge > 0) { curInfo.add("Can breed in " + PneumaticCraftUtils.convertTicksToMinutesAndSeconds(growingAge, false)); } else if(growingAge < 0) { curInfo.add("Becomes adult in " + PneumaticCraftUtils.convertTicksToMinutesAndSeconds(-growingAge, false)); } else { curInfo.add("This animal can be bred"); } }
Example #5
Source File: EntityFluidCow.java From Moo-Fluids with GNU General Public License v3.0 | 5 votes |
@Override public EntityFluidCow createChild(final EntityAgeable entityAgeable) { final EntityFluidCow childEntity = new EntityFluidCow(world); childEntity.setEntityFluid(entityFluid); return childEntity; }
Example #6
Source File: EntityRabbit.java From Et-Futurum with The Unlicense | 5 votes |
@Override public EntityAgeable createChild(EntityAgeable mate) { EntityRabbit baby = new EntityRabbit(worldObj); if (mate instanceof EntityRabbit) baby.setRabbitType(rand.nextBoolean() ? getRabbitType() : ((EntityRabbit) mate).getRabbitType()); return baby; }
Example #7
Source File: EntityTofuCow.java From TofuCraftReload with MIT License | 5 votes |
public EntityTofuCow createChild(EntityAgeable ageable) { EntityTofuCow tofuCow = new EntityTofuCow(this.world); if (this.getVariant() == 1) { if (this.rand.nextInt(2) == 0) { tofuCow.setVariant(0); } else { tofuCow.setVariant(1); } } return tofuCow; }
Example #8
Source File: EntityDabSquirrel.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
@Override public EntityAgeable createChild(EntityAgeable ageable) { EntityDabSquirrel squirrel = new EntityDabSquirrel(this.world); if (ageable instanceof EntityDabSquirrel) { EntityDabSquirrel other = (EntityDabSquirrel) ageable; if ((this.getTypeNumber() == 3 || other.getTypeNumber() == 3) && this.getTypeNumber() != other.getTypeNumber()) { squirrel.setType(this.getTypeNumber() == 3 ? other.getTypeNumber() : this.getTypeNumber()); } else { squirrel.setType(this.rand.nextBoolean() ? this.getTypeNumber() : other.getTypeNumber()); } } return squirrel; }
Example #9
Source File: EntityValentinesCow.java From Moo-Fluids with GNU General Public License v3.0 | 4 votes |
@Override public EntityValentinesCow createChild(EntityAgeable entityAgeable) { return new EntityValentinesCow(world); }
Example #10
Source File: EntityBigCat.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Override public EntityAgeable createChild(EntityAgeable ageable) { return null; }
Example #11
Source File: EntityFoxRed.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Override public EntityAgeable createChild(EntityAgeable ageable) { return null; }
Example #12
Source File: EntityBison.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Override public EntityAgeable createChild(EntityAgeable ageable) { return null; }
Example #13
Source File: EntityBoar.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Override public EntityAgeable createChild(EntityAgeable ageable) { return null; }
Example #14
Source File: EntityHalloweenCow.java From Moo-Fluids with GNU General Public License v3.0 | 4 votes |
@Override public EntityHalloweenCow createChild(EntityAgeable entityAgeable) { return new EntityHalloweenCow(world); }
Example #15
Source File: EntityEasterCow.java From Moo-Fluids with GNU General Public License v3.0 | 4 votes |
@Override public EntityEasterCow createChild(final EntityAgeable entityAgeable) { return new EntityEasterCow(world); }
Example #16
Source File: EntityNewYearsCow.java From Moo-Fluids with GNU General Public License v3.0 | 4 votes |
@Override public EntityNewYearsCow createChild(EntityAgeable entityAgeable) { return new EntityNewYearsCow(world); }
Example #17
Source File: EntityChristmasCow.java From Moo-Fluids with GNU General Public License v3.0 | 4 votes |
@Override public EntityChristmasCow createChild(EntityAgeable entityAgeable) { return new EntityChristmasCow(world); }
Example #18
Source File: EntityPenguin.java From CommunityMod with GNU Lesser General Public License v2.1 | 4 votes |
@Override public EntityAgeable createChild(EntityAgeable ageable) { return new EntityPenguin(ageable.world); }
Example #19
Source File: EntityElk.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Override public EntityAgeable createChild(EntityAgeable ageable) { return null; }
Example #20
Source File: EntityOwl.java From EnderZoo with Creative Commons Zero v1.0 Universal | 4 votes |
@Override public EntityOwl createChild(EntityAgeable ageable) { return new EntityOwl(world); }
Example #21
Source File: MoCEntityAmbient.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
@Override public EntityAgeable createChild(EntityAgeable var1) { return null; }
Example #22
Source File: MoCEntityAnimal.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
@Override public EntityAgeable createChild(EntityAgeable var1) { return null; }
Example #23
Source File: MoCEntityAnimal.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
public MoCEntityAnimal spawnBabyAnimal(EntityAgeable par1EntityAgeable) { return null; }
Example #24
Source File: EntityTrackHandler.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public boolean isApplicable(Entity entity){ return entity instanceof EntityAgeable; }
Example #25
Source File: EntityExplodingChicken.java From CommunityMod with GNU Lesser General Public License v2.1 | 4 votes |
public EntityChicken createChild(EntityAgeable ageable) { return new EntityChicken(this.world); }
Example #26
Source File: BodyguardGolemCore.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public EntityAgeable createChild(EntityAgeable entity) { return null; }
Example #27
Source File: CraftAgeable.java From Kettle with GNU General Public License v3.0 | 4 votes |
public CraftAgeable(CraftServer server, EntityAgeable entity) { super(server, entity); }
Example #28
Source File: CraftAgeable.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public EntityAgeable getHandle() { return (EntityAgeable) entity; }
Example #29
Source File: KillauraHack.java From ForgeWurst with GNU General Public License v3.0 | 4 votes |
@SubscribeEvent public void onUpdate(WUpdateEvent event) { EntityPlayerSP player = event.getPlayer(); World world = WPlayer.getWorld(player); if(player.getCooledAttackStrength(0) < 1) return; double rangeSq = Math.pow(range.getValue(), 2); Stream<EntityLivingBase> stream = world.loadedEntityList .parallelStream().filter(e -> e instanceof EntityLivingBase) .map(e -> (EntityLivingBase)e) .filter(e -> !e.isDead && e.getHealth() > 0) .filter(e -> WEntity.getDistanceSq(player, e) <= rangeSq) .filter(e -> e != player) .filter(e -> !(e instanceof EntityFakePlayer)); if(filterPlayers.isChecked()) stream = stream.filter(e -> !(e instanceof EntityPlayer)); if(filterSleeping.isChecked()) stream = stream.filter(e -> !(e instanceof EntityPlayer && ((EntityPlayer)e).isPlayerSleeping())); if(filterFlying.getValue() > 0) stream = stream.filter(e -> { if(!(e instanceof EntityPlayer)) return true; AxisAlignedBB box = e.getEntityBoundingBox(); box = box.union(box.offset(0, -filterFlying.getValue(), 0)); // Using expand() with negative values doesn't work in 1.10.2. return world.collidesWithAnyBlock(box); }); if(filterMonsters.isChecked()) stream = stream.filter(e -> !(e instanceof IMob)); if(filterPigmen.isChecked()) stream = stream.filter(e -> !(e instanceof EntityPigZombie)); if(filterEndermen.isChecked()) stream = stream.filter(e -> !(e instanceof EntityEnderman)); if(filterAnimals.isChecked()) stream = stream.filter(e -> !(e instanceof EntityAnimal || e instanceof EntityAmbientCreature || e instanceof EntityWaterMob)); if(filterBabies.isChecked()) stream = stream.filter(e -> !(e instanceof EntityAgeable && ((EntityAgeable)e).isChild())); if(filterPets.isChecked()) stream = stream .filter(e -> !(e instanceof EntityTameable && ((EntityTameable)e).isTamed())) .filter(e -> !WEntity.isTamedHorse(e)); if(filterVillagers.isChecked()) stream = stream.filter(e -> !(e instanceof EntityVillager)); if(filterGolems.isChecked()) stream = stream.filter(e -> !(e instanceof EntityGolem)); if(filterInvisible.isChecked()) stream = stream.filter(e -> !e.isInvisible()); target = stream.min(priority.getSelected().comparator).orElse(null); if(target == null) return; RotationUtils .faceVectorPacket(target.getEntityBoundingBox().getCenter()); mc.playerController.attackEntity(player, target); player.swingArm(EnumHand.MAIN_HAND); }
Example #30
Source File: EntityMoby.java From mobycraft with Apache License 2.0 | 4 votes |
public EntityMoby createChild(EntityAgeable ageable) { return new EntityMoby(this.worldObj); }