public void setAgeProps(Ageable a, ISpawnableEntity data) { if (data.getAge(a) == -2) { a.setBaby(); } else if (data.getAge(a) == -1) { a.setAdult(); } else { a.setAge(data.getAge(a)); } }
protected Entity setEntity(MageController controller, Entity entity) { this.entity = entity; if (noTarget) { entity.setMetadata("notarget", new FixedMetadataValue(controller.getPlugin(), true)); } if (customName != null) { entity.setCustomName(customName); entity.setCustomNameVisible(true); } if (entity instanceof LivingEntity) { ((LivingEntity) entity).setMaxHealth(1000.0); ((LivingEntity) entity).setHealth(1000.0); } if (entity instanceof Slime) { ((Slime) entity).setSize(1); } if (entity instanceof Ageable) { if (isBaby) { ((Ageable) entity).setBaby(); } else { ((Ageable) entity).setAdult(); } } else if (entity instanceof Zombie) { ((Zombie) entity).setBaby(isBaby); } else if (entity instanceof PigZombie) { ((PigZombie) entity).setBaby(isBaby); } else if (entity instanceof Slime && isBaby) { Slime slime = (Slime) entity; slime.setSize(0); } if (entity instanceof Horse) { Horse.Variant variant = Horse.Variant.UNDEAD_HORSE; if (variantName != null) { try { variant = Horse.Variant.valueOf(variantName.toUpperCase()); } catch (Exception ex) { } } else { variant = Horse.Variant.UNDEAD_HORSE; } ((Horse) entity).setVariant(variant); } if (entity instanceof Ocelot) { Ocelot ocelot = (Ocelot) entity; Ocelot.Type variant = Ocelot.Type.WILD_OCELOT; if (variantName != null) { try { variant = Ocelot.Type.valueOf(variantName.toUpperCase()); } catch (Exception ex) { } } else { variant = Ocelot.Type.WILD_OCELOT; } ocelot.setCatType(variant); } if (entity instanceof Sheep) { Sheep sheep = (Sheep) entity; DyeColor color = DyeColor.WHITE; if (variantName != null) { try { color = DyeColor.valueOf(variantName.toUpperCase()); } catch (Exception ex) { } } sheep.setColor(color); } if (entity instanceof Wolf) { Wolf wolf = (Wolf) entity; if (variantName != null) { // Only set collar color if a variant is set.. // this makes it a dog, versus a wolf. Technically. DyeColor color = DyeColor.RED; try { color = DyeColor.valueOf(variantName.toUpperCase()); wolf.setTamed(true); } catch (Exception ex) { } wolf.setCollarColor(color); } } targeting.ignoreEntity(entity); return entity; }