@Override public boolean isAdult() { return a.isAdult(); }
@Override public int getAge() { return a.getAge(); }
@Override public void setBaby() { a.setBaby(); }
protected void tick(Block b) throws Exception { for (Entity n: me.mrCookieSlime.Slimefun.holograms.AnimalGrowthAccelerator.getArmorStand(b).getNearbyEntities(3D, 3D, 3D)) { if (n instanceof Ageable && !((Ageable) n).isAdult()) { for (int slot: getInputSlots()) { if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), SlimefunItems.ORGANIC_FOOD, false)) { if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return; ChargableBlock.addCharge(b, -getEnergyConsumption()); BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), 1)); ((Ageable) n).setAge(((Ageable) n).getAge() + 2000); if (((Ageable) n).getAge() > 0) ((Ageable) n).setAge(0); n.getWorld().spawnParticle(Particle.VILLAGER_HAPPY,((LivingEntity) n).getEyeLocation(), 8, 0.2F, 0.2F, 0.2F); return; } } } } }
@Override public void setAdult() { a.setAdult(); }
@Override public void setAge(int age) { a.setAge(age); }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onInteract(CreatureSpawnEvent event) { Entity ent = event.getEntity(); if (!(ent instanceof Ageable)) { return; } if (!event.getSpawnReason().equals(SpawnReason.BREEDING)) { return; } Location l = ent.getLocation(); String w = l.getWorld().getName(); if (!plugin.getTrackerKeeper().getSiegeBreedingAreas().containsKey(w)) { return; } plugin.getTrackerKeeper().getSiegeBreedingAreas().get(w).forEach((area) -> { if (area.isInSiegeArea(l) && random.nextInt(100) < chance) { // make them twins plugin.setTardisSpawn(true); Ageable twin = (Ageable) l.getWorld().spawnEntity(l, ent.getType()); twin.setBaby(); } }); } }
@Override public Age convert(Entity e) { if (e instanceof Ageable) { if (((Ageable) e).isAdult()) { System.out.println("Adult"); return Age.ADULT; } System.out.println("Baby"); return Age.BABY; } System.out.println("Null"); return null; }
((Ageable) bukkitEntity).setBaby();
public void convertAgable(Ageable ageable, TagCompound properties) { properties.getCompoundData().put("Baby", new TagByte(!ageable.isAdult())); }
((Ageable)entity).setBaby(); } else switch (entity.getType()) { case PHANTOM:
baby = ((Zombie) disguisedEntity).isBaby(); } else if (disguisedEntity instanceof Ageable) { baby = !((Ageable) disguisedEntity).isAdult();