gt:                     byte var4 = -1;
context: package net.minecraft.entity.passive;
  
  import java.util.Iterator;
  import java.util.List;
  import net.minecraft.block.Block;
  import net.minecraft.block.material.Material;
  import net.minecraft.command.IEntitySelector;
  import net.minecraft.entity.Entity;
  import net.minecraft.entity.EntityAgeable;
  import net.minecraft.entity.EntityLivingBase;
  import net.minecraft.entity.IEntityLivingData;
  import net.minecraft.entity.SharedMonsterAttributes;
  import net.minecraft.entity.ai.EntityAIFollowParent;
  import net.minecraft.entity.ai.EntityAILookIdle;
  import net.minecraft.entity.ai.EntityAIMate;
  import net.minecraft.entity.ai.EntityAIPanic;
  import net.minecraft.entity.ai.EntityAIRunAroundLikeCrazy;
  import net.minecraft.entity.ai.EntityAISwimming;
  import net.minecraft.entity.ai.EntityAIWander;
  import net.minecraft.entity.ai.EntityAIWatchClosest;
  import net.minecraft.entity.ai.attributes.IAttribute;
  import net.minecraft.entity.ai.attributes.IAttributeInstance;
  import net.minecraft.entity.ai.attributes.RangedAttribute;
  import net.minecraft.entity.player.EntityPlayer;
  import net.minecraft.init.Blocks;
  import net.minecraft.init.Items;
  import net.minecraft.inventory.AnimalChest;
  import net.minecraft.inventory.IInvBasic;
  import net.minecraft.inventory.InventoryBasic;
  import net.minecraft.item.Item;
  import net.minecraft.item.ItemStack;
  import net.minecraft.nbt.NBTTagCompound;
  import net.minecraft.nbt.NBTTagList;
  import net.minecraft.pathfinding.PathEntity;
  import net.minecraft.potion.Potion;
  import net.minecraft.util.DamageSource;
  import net.minecraft.util.MathHelper;
  import net.minecraft.util.StatCollector;
  import net.minecraft.world.World;
  
  public class EntityHorse extends EntityAnimal implements IInvBasic
  {
      private static final IEntitySelector horseBreedingSelector = new IEntitySelector()
      {
          private static final String __OBFID = "CL_00001642";
          public boolean isEntityApplicable(Entity p_82704_1_)
          {
              return p_82704_1_ instanceof EntityHorse && ((EntityHorse)p_82704_1_).func_110205_ce();
          }
      };
      private static final IAttribute horseJumpStrength = (new RangedAttribute("horse.jumpStrength", 0.7D, 0.0D, 2.0D)).setDescription("Jump Strength").setShouldWatch(true);
      private static final String[] horseArmorTextures = new String[] {null, "textures/entity/horse/armor/horse_armor_iron.png", "textures/entity/horse/armor/horse_armor_gold.png", "textures/entity/horse/armor/horse_armor_diamond.png"};
      private static final String[] field_110273_bx = new String[] {"", "meo", "goo", "dio"};
      private static final int[] armorValues = new int[] {0, 5, 7, 11};
      private static final String[] horseTextures = new String[] {"textures/entity/horse/horse_white.png", "textures/entity/horse/horse_creamy.png", "textures/entity/horse/horse_chestnut.png", "textures/entity/horse/horse_brown.png", "textures/entity/horse/horse_black.png", "textures/entity/horse/horse_gray.png", "textures/entity/horse/horse_darkbrown.png"};
      private static final String[] field_110269_bA = new String[] {"hwh", "hcr", "hch", "hbr", "hbl", "hgr", "hdb"};
      private static final String[] horseMarkingTextures = new String[] {null, "textures/entity/horse/horse_markings_white.png", "textures/entity/horse/horse_markings_whitefield.png", "textures/entity/horse/horse_markings_whitedots.png", "textures/entity/horse/horse_markings_blackdots.png"};
      private static final String[] field_110292_bC = new String[] {"", "wo_", "wmo", "wdo", "bdo"};
      private int eatingHaystackCounter;
      private int openMouthCounter;
      private int jumpRearingCounter;
      public int field_110278_bp;
      public int field_110279_bq;
      protected boolean horseJumping;
      private AnimalChest horseChest;
      private boolean hasReproduced;
  
      /**
       * "The higher this value, the more likely the horse is to be tamed next time a player rides it."
       */
      protected int temper;
      protected float jumpPower;
      private boolean field_110294_bI;
      private float headLean;
      private float prevHeadLean;
      private float rearingAmount;
      private float prevRearingAmount;
      private float mouthOpenness;
      private float prevMouthOpenness;
      private int field_110285_bP;
      private String field_110286_bQ;
      private String[] field_110280_bR = new String[3];
      private static final String __OBFID = "CL_00001641";
  
      public EntityHorse(World p_i1685_1_)
      {
          super(p_i1685_1_);
          this.setSize(1.4F, 1.6F);
          this.isImmuneToFire = false;
          this.setChested(false);
          this.getNavigator().setAvoidsWater(true);
          this.tasks.addTask(0, new EntityAISwimming(this));
          this.tasks.addTask(1, new EntityAIPanic(this, 1.2D));
          this.tasks.addTask(1, new EntityAIRunAroundLikeCrazy(this, 1.2D));
          this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
          this.tasks.addTask(4, new EntityAIFollowParent(this, 1.0D));
          this.tasks.addTask(6, new EntityAIWander(this, 0.7D));
          this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
          this.tasks.addTask(8, new EntityAILookIdle(this));
          this.func_110226_cD();
      }
  
      protected void entityInit()
      {
          super.entityInit();
          this.dataWatcher.addObject(16, Integer.valueOf(0));
          this.dataWatcher.addObject(19, Byte.valueOf((byte)0));
          this.dataWatcher.addObject(20, Integer.valueOf(0));
          this.dataWatcher.addObject(21, String.valueOf(""));
          this.dataWatcher.addObject(22, Integer.valueOf(0));
      }
  
      public void setHorseType(int p_110214_1_)
      {
          this.dataWatcher.updateObject(19, Byte.valueOf((byte)p_110214_1_));
          this.func_110230_cF();
      }
  
      /**
       * returns the horse type
       */
      public int getHorseType()
      {
          return this.dataWatcher.getWatchableObjectByte(19);
      }
  
      public void setHorseVariant(int p_110235_1_)
      {
          this.dataWatcher.updateObject(20, Integer.valueOf(p_110235_1_));
          this.func_110230_cF();
      }
  
      public int getHorseVariant()
      {
          return this.dataWatcher.getWatchableObjectInt(20);
      }
  
      /**
       * Gets the name of this command sender (usually username, but possibly "Rcon")
       */
      public String getCommandSenderName()
      {
          if (this.hasCustomNameTag())
          {
              return this.getCustomNameTag();
          }
          else
          {
              int var1 = this.getHorseType();
  
              switch (var1)
              {
                  case 0:
                  default:
                      return StatCollector.translateToLocal("entity.horse.name");
  
                  case 1:
                      return StatCollector.translateToLocal("entity.donkey.name");
  
                  case 2:
                      return StatCollector.translateToLocal("entity.mule.name");
  
                  case 3:
                      return StatCollector.translateToLocal("entity.zombiehorse.name");
  
                  case 4:
                      return StatCollector.translateToLocal("entity.skeletonhorse.name");
              }
          }
      }
  
      private boolean getHorseWatchableBoolean(int p_110233_1_)
      {
          return (this.dataWatcher.getWatchableObjectInt(16) & p_110233_1_) != 0;
      }
  
      private void setHorseWatchableBoolean(int p_110208_1_, boolean p_110208_2_)
      {
          int var3 = this.dataWatcher.getWatchableObjectInt(16);
  
          if (p_110208_2_)
          {
              this.dataWatcher.updateObject(16, Integer.valueOf(var3 | p_110208_1_));
          }
          else
          {
              this.dataWatcher.updateObject(16, Integer.valueOf(var3 & ~p_110208_1_));
          }
      }
  
      public boolean isAdultHorse()
      {
          return !this.isChild();
      }
  
      public boolean isTame()
      {
          return this.getHorseWatchableBoolean(2);
      }
  
      public boolean func_110253_bW()
      {
          return this.isAdultHorse();
      }
  
      public String func_152119_ch()
      {
          return this.dataWatcher.getWatchableObjectString(21);
      }
  
      public void func_152120_b(String p_152120_1_)
      {
          this.dataWatcher.updateObject(21, p_152120_1_);
      }
  
      public float getHorseSize()
      {
          int var1 = this.getGrowingAge();
          return var1 >= 0 ? 1.0F : 0.5F + (float)(-24000 - var1) / -24000.0F * 0.5F;
      }
  
      /**
       * "Sets the scale for an ageable entity according to the boolean parameter, which says if it's a child."
       */
      public void setScaleForAge(boolean p_98054_1_)
      {
          if (p_98054_1_)
          {
              this.setScale(this.getHorseSize());
          }
          else
          {
              this.setScale(1.0F);
          }
      }
  
      public boolean isHorseJumping()
      {
          return this.horseJumping;
      }
  
      public void setHorseTamed(boolean p_110234_1_)
      {
          this.setHorseWatchableBoolean(2, p_110234_1_);
      }
  
      public void setHorseJumping(boolean p_110255_1_)
      {
          this.horseJumping = p_110255_1_;
      }
  
      public boolean allowLeashing()
      {
          return !this.func_110256_cu() && super.allowLeashing();
      }
  
      protected void func_142017_o(float p_142017_1_)
      {
          if (p_142017_1_ > 6.0F && this.isEatingHaystack())
          {
              this.setEatingHaystack(false);
          }
      }
  
      public boolean isChested()
      {
          return this.getHorseWatchableBoolean(8);
      }
  
      public int func_110241_cb()
      {
          return this.dataWatcher.getWatchableObjectInt(22);
      }
  
      /**
       * 0 = iron, 1 = gold, 2 = diamond
       */
      private int getHorseArmorIndex(ItemStack p_110260_1_)
      {
          if (p_110260_1_ == null)
          {
              return 0;
          }
          else
          {
              Item var2 = p_110260_1_.getItem();
              return var2 == Items.iron_horse_armor ? 1 : (var2 == Items.golden_horse_armor ? 2 : (var2 == Items.diamond_horse_armor ? 3 : 0));
          }
      }
  
      public boolean isEatingHaystack()
      {
          return this.getHorseWatchableBoolean(32);
      }
  
      public boolean isRearing()
      {
          return this.getHorseWatchableBoolean(64);
      }
  
      public boolean func_110205_ce()
      {
          return this.getHorseWatchableBoolean(16);
      }
  
      public boolean getHasReproduced()
      {
          return this.hasReproduced;
      }
  
      public void func_146086_d(ItemStack p_146086_1_)
      {
          this.dataWatcher.updateObject(22, Integer.valueOf(this.getHorseArmorIndex(p_146086_1_)));
          this.func_110230_cF();
      }
  
      public void func_110242_l(boolean p_110242_1_)
      {
          this.setHorseWatchableBoolean(16, p_110242_1_);
      }
  
      public void setChested(boolean p_110207_1_)
      {
          this.setHorseWatchableBoolean(8, p_110207_1_);
      }
  
      public void setHasReproduced(boolean p_110221_1_)
      {
          this.hasReproduced = p_110221_1_;
      }
  
      public void setHorseSaddled(boolean p_110251_1_)
      {
          this.setHorseWatchableBoolean(4, p_110251_1_);
      }
  
      public int getTemper()
      {
          return this.temper;
      }
  
      public void setTemper(int p_110238_1_)
      {
          this.temper = p_110238_1_;
      }
  
      public int increaseTemper(int p_110198_1_)
      {
          int var2 = MathHelper.clamp_int(this.getTemper() + p_110198_1_, 0, this.getMaxTemper());
          this.setTemper(var2);
          return var2;
      }
  
      /**
       * Called when the entity is attacked.
       */
      public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
      {
          Entity var3 = p_70097_1_.getEntity();
          return this.riddenByEntity != null && this.riddenByEntity.equals(var3) ? false : super.attackEntityFrom(p_70097_1_, p_70097_2_);
      }
  
      /**
       * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
       */
      public int getTotalArmorValue()
      {
          return armorValues[this.func_110241_cb()];
      }
  
      /**
       * Returns true if this entity should push and be pushed by other entities when colliding.
       */
      public boolean canBePushed()
      {
          return this.riddenByEntity == null;
      }
  
      public boolean prepareChunkForSpawn()
      {
          int var1 = MathHelper.floor_double(this.posX);
          int var2 = MathHelper.floor_double(this.posZ);
          this.worldObj.getBiomeGenForCoords(var1, var2);
          return true;
      }
  
      public void dropChests()
      {
          if (!this.worldObj.isClient && this.isChested())
          {
              this.func_145779_a(Item.getItemFromBlock(Blocks.chest), 1);
              this.setChested(false);
          }
      }
  
      private void func_110266_cB()
      {
          this.openHorseMouth();
          this.worldObj.playSoundAtEntity(this, "eating", 1.0F, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
      }
  
      /**
       * Called when the mob is falling. Calculates and applies fall damage.
       */
      protected void fall(float p_70069_1_)
      {
          if (p_70069_1_ > 1.0F)
          {
              this.playSound("mob.horse.land", 0.4F, 1.0F);
          }
  
          int var2 = MathHelper.ceiling_float_int(p_70069_1_ * 0.5F - 3.0F);
  
          if (var2 > 0)
          {
              this.attackEntityFrom(DamageSource.fall, (float)var2);
  
              if (this.riddenByEntity != null)
              {
                  this.riddenByEntity.attackEntityFrom(DamageSource.fall, (float)var2);
              }
  
              Block var3 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY - 0.2D - (double)this.prevRotationYaw), MathHelper.floor_double(this.posZ));
  
              if (var3.getMaterial() != Material.air)
              {
                  Block.SoundType var4 = var3.stepSound;
                  this.worldObj.playSoundAtEntity(this, var4.getStepResourcePath(), var4.getVolume() * 0.5F, var4.getFrequency() * 0.75F);
              }
          }
      }
  
      private int func_110225_cC()
      {
          int var1 = this.getHorseType();
          return this.isChested() && (var1 == 1 || var1 == 2) ? 17 : 2;
      }
  
      private void func_110226_cD()
      {
          AnimalChest var1 = this.horseChest;
          this.horseChest = new AnimalChest("HorseChest", this.func_110225_cC());
          this.horseChest.func_110133_a(this.getCommandSenderName());
  
          if (var1 != null)
          {
              var1.func_110132_b(this);
              int var2 = Math.min(var1.getSizeInventory(), this.horseChest.getSizeInventory());
  
              for (int var3 = 0; var3 < var2; ++var3)
              {
                  ItemStack var4 = var1.getStackInSlot(var3);
  
                  if (var4 != null)
                  {
                      this.horseChest.setInventorySlotContents(var3, var4.copy());
                  }
              }
  
              var1 = null;
          }
  
          this.horseChest.func_110134_a(this);
          this.func_110232_cE();
      }
  
      private void func_110232_cE()
      {
          if (!this.worldObj.isClient)
          {
              this.setHorseSaddled(this.horseChest.getStackInSlot(0) != null);
  
              if (this.func_110259_cr())
              {
                  this.func_146086_d(this.horseChest.getStackInSlot(1));
              }
          }
      }
  
      /**
       * Called by InventoryBasic.onInventoryChanged() on a array that is never filled.
       */
      public void onInventoryChanged(InventoryBasic p_76316_1_)
      {
          int var2 = this.func_110241_cb();
          boolean var3 = this.isHorseSaddled();
          this.func_110232_cE();
  
          if (this.ticksExisted > 20)
          {
              if (var2 == 0 && var2 != this.func_110241_cb())
              {
                  this.playSound("mob.horse.armor", 0.5F, 1.0F);
              }
              else if (var2 != this.func_110241_cb())
              {
                  this.playSound("mob.horse.armor", 0.5F, 1.0F);
              }
  
              if (!var3 && this.isHorseSaddled())
              {
                  this.playSound("mob.horse.leather", 0.5F, 1.0F);
              }
          }
      }
  
      /**
       * Checks if the entity's current position is a valid location to spawn this entity.
       */
      public boolean getCanSpawnHere()
      {
          this.prepareChunkForSpawn();
          return super.getCanSpawnHere();
      }
  
      protected EntityHorse getClosestHorse(Entity p_110250_1_, double p_110250_2_)
      {
          double var4 = Double.MAX_VALUE;
          Entity var6 = null;
          List var7 = this.worldObj.getEntitiesWithinAABBExcludingEntity(p_110250_1_, p_110250_1_.boundingBox.addCoord(p_110250_2_, p_110250_2_, p_110250_2_), horseBreedingSelector);
          Iterator var8 = var7.iterator();
  
          while (var8.hasNext())
          {
              Entity var9 = (Entity)var8.next();
              double var10 = var9.getDistanceSq(p_110250_1_.posX, p_110250_1_.posY, p_110250_1_.posZ);
  
              if (var10 < var4)
              {
                  var6 = var9;
                  var4 = var10;
              }
          }
  
          return (EntityHorse)var6;
      }
  
      public double getHorseJumpStrength()
      {
          return this.getEntityAttribute(horseJumpStrength).getAttributeValue();
      }
  
      /**
       * Returns the sound this mob makes on death.
       */
      protected String getDeathSound()
      {
          this.openHorseMouth();
          int var1 = this.getHorseType();
          return var1 == 3 ? "mob.horse.zombie.death" : (var1 == 4 ? "mob.horse.skeleton.death" : (var1 != 1 && var1 != 2 ? "mob.horse.death" : "mob.horse.donkey.death"));
      }
  
      protected Item func_146068_u()
      {
          boolean var1 = this.rand.nextInt(4) == 0;
          int var2 = this.getHorseType();
          return var2 == 4 ? Items.bone : (var2 == 3 ? (var1 ? Item.getItemById(0) : Items.rotten_flesh) : Items.leather);
      }
  
      /**
       * Returns the sound this mob makes when it is hurt.
       */
      protected String getHurtSound()
      {
          this.openHorseMouth();
  
          if (this.rand.nextInt(3) == 0)
          {
              this.makeHorseRear();
          }
  
          int var1 = this.getHorseType();
          return var1 == 3 ? "mob.horse.zombie.hit" : (var1 == 4 ? "mob.horse.skeleton.hit" : (var1 != 1 && var1 != 2 ? "mob.horse.hit" : "mob.horse.donkey.hit"));
      }
  
      public boolean isHorseSaddled()
      {
          return this.getHorseWatchableBoolean(4);
      }
  
      /**
       * Returns the sound this mob makes while it's alive.
       */
      protected String getLivingSound()
      {
          this.openHorseMouth();
  
          if (this.rand.nextInt(10) == 0 && !this.isMovementBlocked())
          {
              this.makeHorseRear();
          }
  
          int var1 = this.getHorseType();
          return var1 == 3 ? "mob.horse.zombie.idle" : (var1 == 4 ? "mob.horse.skeleton.idle" : (var1 != 1 && var1 != 2 ? "mob.horse.idle" : "mob.horse.donkey.idle"));
      }
  
      protected String getAngrySoundName()
      {
          this.openHorseMouth();
          this.makeHorseRear();
          int var1 = this.getHorseType();
          return var1 != 3 && var1 != 4 ? (var1 != 1 && var1 != 2 ? "mob.horse.angry" : "mob.horse.donkey.angry") : null;
      }
  
      protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_)
      {
          Block.SoundType var5 = p_145780_4_.stepSound;
  
          if (this.worldObj.getBlock(p_145780_1_, p_145780_2_ + 1, p_145780_3_) == Blocks.snow_layer)
          {
              var5 = Blocks.snow_layer.stepSound;
          }
  
          if (!p_145780_4_.getMaterial().isLiquid())
          {
              int var6 = this.getHorseType();
  
              if (this.riddenByEntity != null && var6 != 1 && var6 != 2)
              {
                  ++this.field_110285_bP;
  
                  if (this.field_110285_bP > 5 && this.field_110285_bP % 3 == 0)
                  {
                      this.playSound("mob.horse.gallop", var5.getVolume() * 0.15F, var5.getFrequency());
  
                      if (var6 == 0 && this.rand.nextInt(10) == 0)
                      {
                          this.playSound("mob.horse.breathe", var5.getVolume() * 0.6F, var5.getFrequency());
                      }
                  }
                  else if (this.field_110285_bP <= 5)
                  {
                      this.playSound("mob.horse.wood", var5.getVolume() * 0.15F, var5.getFrequency());
                  }
              }
              else if (var5 == Block.soundTypeWood)
              {
                  this.playSound("mob.horse.wood", var5.getVolume() * 0.15F, var5.getFrequency());
              }
              else
              {
                  this.playSound("mob.horse.soft", var5.getVolume() * 0.15F, var5.getFrequency());
              }
          }
      }
  
      protected void applyEntityAttributes()
      {
          super.applyEntityAttributes();
          this.getAttributeMap().registerAttribute(horseJumpStrength);
          this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(53.0D);
          this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.22499999403953552D);
      }
  
      /**
       * Will return how many at most can spawn in a chunk at once.
       */
      public int getMaxSpawnedInChunk()
      {
          return 6;
      }
  
      public int getMaxTemper()
      {
          return 100;
      }
  
      /**
       * Returns the volume for the sounds this mob makes.
       */
      protected float getSoundVolume()
      {
          return 0.8F;
      }
  
      /**
       * Get number of ticks, at least during which the living entity will be silent.
       */
      public int getTalkInterval()
      {
          return 400;
      }
  
      private void func_110230_cF()
      {
          this.field_110286_bQ = null;
      }
  
      public void openGUI(EntityPlayer p_110199_1_)
      {
          if (!this.worldObj.isClient && (this.riddenByEntity == null || this.riddenByEntity == p_110199_1_) && this.isTame())
          {
              this.horseChest.func_110133_a(this.getCommandSenderName());
              p_110199_1_.displayGUIHorse(this, this.horseChest);
          }
      }
  
      /**
       * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
       */
      public boolean interact(EntityPlayer p_70085_1_)
      {
          ItemStack var2 = p_70085_1_.inventory.getCurrentItem();
  
          if (var2 != null && var2.getItem() == Items.spawn_egg)
          {
              return super.interact(p_70085_1_);
          }
          else if (!this.isTame() && this.func_110256_cu())
          {
              return false;
          }
          else if (this.isTame() && this.isAdultHorse() && p_70085_1_.isSneaking())
          {
              this.openGUI(p_70085_1_);
              return true;
          }
          else if (this.func_110253_bW() && this.riddenByEntity != null)
          {
              return super.interact(p_70085_1_);
          }
          else
          {
              if (var2 != null)
              {
                  boolean var3 = false;
  
                  if (this.func_110259_cr())
                  {
  