package com.elmakers.mine.bukkit.entity;

import org.bukkit.entity.Entity;
import org.bukkit.entity.Horse;
import org.bukkit.inventory.ItemStack;

public class EntityHorseData extends EntityExtraData {
    public Horse.Color color;
    public Horse.Variant variant;
    public Horse.Style style;
    public ItemStack saddle;
    public ItemStack armor;
    public Integer domestication;
    public Integer maxDomestication;
    public Double jumpStrength;
    public Boolean tamed;

    public EntityHorseData() {

    }

    public EntityHorseData(Horse horse) {
        color = horse.getColor();
        variant = horse.getVariant();
        style = horse.getStyle();
        saddle = horse.getInventory().getSaddle();
        armor = horse.getInventory().getArmor();
        domestication = horse.getDomestication();
        maxDomestication = horse.getMaxDomestication();
        jumpStrength = horse.getJumpStrength();
        tamed = horse.isTamed();
    }

    @Override
    public void apply(Entity entity) {
        if (!(entity instanceof Horse)) return;
        Horse horse = (Horse)entity;

        horse.getInventory().setSaddle(saddle);
        horse.getInventory().setArmor(armor);
        if (color != null) {
            horse.setColor(color);
        }
        if (variant != null) {
            horse.setVariant(variant);
        }
        if (style != null) {
            horse.setStyle(style);
        }
        if (domestication != null) {
            horse.setDomestication(domestication);
        }
        if (maxDomestication != null) {
            horse.setMaxDomestication(maxDomestication);
        }
        if (jumpStrength != null) {
            horse.setJumpStrength(jumpStrength);
        }
        if (tamed != null) {
            horse.setTamed(tamed);
        }
    }

    @Override
    public EntityExtraData clone() {
        EntityHorseData copy = new EntityHorseData();
        copy.saddle = saddle == null ? null : saddle.clone();
        copy.armor = armor == null ? null : armor.clone();
        copy.color = color;
        copy.variant = variant;
        copy.domestication = domestication;
        copy.style = style;
        copy.maxDomestication = maxDomestication;
        copy.jumpStrength = jumpStrength;
        copy.tamed = tamed;
        return copy;
    }

    @Override
    public void removed(Entity entity) {
    }
}

@@ -229,42 +229,8 @@
 or;%0A
-    public Horse.Variant variant;%0A
     
@@ -251,24 +251,24 @@
 tyle style;%0A
+
     public I
@@ -561,46 +561,8 @@
 ();%0A
-        variant = horse.getVariant();%0A
     
@@ -1196,88 +1196,8 @@
   %7D%0A
-        if (variant != null) %7B%0A            horse.setVariant(variant);%0A        %7D%0A
     
@@ -1865,32 +1865,32 @@
  armor.clone();%0A
+
         copy.col
@@ -1905,40 +1905,8 @@
 or;%0A
-        copy.variant = variant;%0A
     

Remove Horse variant from EntityData since it is no longer supported