@Override public MCHorsePattern getPattern() { return BukkitMCHorsePattern.getConvertor().getAbstractedEnum(h.getStyle()); }
public EntityHorseData(Horse horse) { color = horse.getColor(); style = horse.getStyle(); saddle = getItem(horse.getInventory().getSaddle()); armor = getItem(horse.getInventory().getArmor()); domestication = horse.getDomestication(); maxDomestication = horse.getMaxDomestication(); jumpStrength = horse.getJumpStrength(); tamed = horse.isTamed(); }
public void convertHorse(Horse horse, TagCompound properties) { byte type = (byte) horse.getVariant().ordinal(); int style = horse.getStyle().ordinal(); int color = horse.getColor().ordinal(); int variant = color & 255 | style << 8; if (horse.getInventory().getArmor() != null) { TagCompound armor = MyPetApi.getPlatformHelper().itemStackToCompund(horse.getInventory().getArmor()); properties.getCompoundData().put("Armor", armor); } if (horse.getInventory().getSaddle() != null) { TagCompound saddle = MyPetApi.getPlatformHelper().itemStackToCompund(horse.getInventory().getSaddle()); properties.getCompoundData().put("Saddle", saddle); } properties.getCompoundData().put("Type", new TagByte(type)); properties.getCompoundData().put("Variant", new TagInt(variant)); properties.getCompoundData().put("Chest", new TagByte(horse.isCarryingChest())); properties.getCompoundData().put("Age", new TagInt(horse.getAge())); if (horse.isCarryingChest()) { ItemStack[] contents = horse.getInventory().getContents(); for (int i = 2; i < contents.length; i++) { ItemStack item = contents[i]; if (item != null) { horse.getWorld().dropItem(horse.getLocation(), item); } } } }
Horse hh = (Horse) e; tmhor.setHorseColour(hh.getColor()); tmhor.setHorseStyle(hh.getStyle());
Horse pony = (Horse) horse; tmhor.setHorseColour(pony.getColor()); tmhor.setHorseStyle(pony.getStyle());
en.set("style", horse.getStyle().name());
color = colorValues[(color.ordinal() + 1) % colorValues.length]; Style horseStyle = horse.getStyle(); Style[] styleValues = Style.values(); horseStyle = styleValues[(horseStyle.ordinal() + 1) % styleValues.length];
color = colorValues[(color.ordinal() + 1) % colorValues.length]; Horse.Style horseStyle = horse.getStyle(); Horse.Style[] styleValues = Horse.Style.values(); horseStyle = styleValues[(horseStyle.ordinal() + 1) % styleValues.length];