gt: 		Iterator iterator = list.iterator();
context: package com.bioxx.tfc.Entities.Mobs;
  
  import java.nio.ByteBuffer;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  import net.minecraft.command.IEntitySelector;
  import net.minecraft.entity.Entity;
  import net.minecraft.entity.EntityAgeable;
  import net.minecraft.entity.EntityLiving;
  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.EntityAIRunAroundLikeCrazy;
  import net.minecraft.entity.ai.EntityAISwimming;
  import net.minecraft.entity.ai.EntityAITempt;
  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.RangedAttribute;
  import net.minecraft.entity.passive.EntityAnimal;
  import net.minecraft.entity.passive.EntityHorse;
  import net.minecraft.entity.player.EntityPlayer;
  import net.minecraft.init.Items;
  import net.minecraft.inventory.AnimalChest;
  import net.minecraft.inventory.IInvBasic;
  import net.minecraft.item.Item;
  import net.minecraft.item.ItemStack;
  import net.minecraft.nbt.NBTTagCompound;
  import net.minecraft.nbt.NBTTagList;
  import net.minecraft.util.ChatComponentText;
  import net.minecraft.util.MathHelper;
  import net.minecraft.util.StatCollector;
  import net.minecraft.util.Vec3;
  import net.minecraft.world.World;
  
  import com.bioxx.tfc.TFCBlocks;
  import com.bioxx.tfc.TFCItems;
  import com.bioxx.tfc.TerraFirmaCraft;
  import com.bioxx.tfc.Core.TFC_Core;
  import com.bioxx.tfc.Core.TFC_Time;
  import com.bioxx.tfc.Entities.AI.AIEatGrass;
  import com.bioxx.tfc.Entities.AI.EntityAIAvoidEntityTFC;
  import com.bioxx.tfc.Entities.AI.EntityAIMateTFC;
  import com.bioxx.tfc.Entities.AI.EntityAIPanicTFC;
  import com.bioxx.tfc.Food.ItemFoodTFC;
  import com.bioxx.tfc.Items.ItemCustomNameTag;
  import com.bioxx.tfc.api.Entities.IAnimal;
  import com.bioxx.tfc.api.Util.Helper;
  
  public class EntityHorseTFC extends EntityHorse implements IInvBasic, IAnimal
  {
  	private static final IEntitySelector horseBreedingSelector = new EntityHorseBredSelector();
  	private static final IAttribute horseJumpStrength = (new RangedAttribute("horse.jumpStrengthTFC", 0.7D, 0.0D, 2.0D)).setDescription("Jump StrengthTFC").setShouldWatch(true);
  	private AnimalChest horseChest;
  
  	public int inLove;
  
  	private final AIEatGrass aiEatGrass = new AIEatGrass(this);
  	protected long animalID;
  	protected int sex = 0;
  	protected int hunger = 0;
  	protected boolean pregnant;
  	protected int pregnancyRequiredTime;
  	protected long conception;
  	public float size_mod;			//How large the animal is
  	public float strength_mod;		//how strong the animal is
  	public float aggression_mod = 1;//How aggressive / obstinate the animal is
  	public float obedience_mod = 1;	//How well the animal responds to commands.
  	public float colour_mod = 1;	//what the animal looks like
  	public float climate_mod = 1;	//climate adaptability
  	public float hard_mod = 1;		//hardiness
  
  	protected float mateSizeMod = 0;
  	protected float mateStrengthMod = 0;
  	protected float mateAggroMod = 0;
  	protected float mateObedMod = 0;
  	protected float mateColMod = 0;
  	protected float mateClimMod = 0;
  	protected float mateHardMod = 0;
  	public boolean isInLove;
  	public Vec3 attackedVec = null;
  	public Entity fearSource = null;
  
  	int degreeOfDiversion = 2;
  
  	private String field_110286_bQ;
  	private String[] field_110280_bR = new String[3];
  
  	private int familiarity = 0;
  	private long lastFamiliarityUpdate = 0;
  	private boolean familiarizedToday = false;
  
  	protected float avgAdultWeight = 550;			//The average weight of adult males in kg
  	protected float dimorphism = 0.0813f;		//1 - dimorphism = the average relative size of females : males. This is calculated by cube-square law from
  	//the square root of the ratio of female mass : male mass
  
  	public EntityHorseTFC(World par1World)
  	{
  		super(par1World);
  		animalID = TFC_Time.getTotalTicks() + getEntityId();
  		hunger = 168000;
  		pregnant = false;
  		pregnancyRequiredTime =(int)(11.17 * TFC_Time.ticksInMonth);
  		conception = 0;
  		sex = rand.nextInt(2);
  		size_mod =(float)Math.sqrt((((rand.nextInt (rand.nextInt((degreeOfDiversion + 1)*10)+1) * (rand.nextBoolean() ? 1 : -1)) * 0.01f) + 1F) * (1.0F - dimorphism * sex));
  		strength_mod = (float)Math.sqrt((((rand.nextInt (rand.nextInt(degreeOfDiversion*10)+1) * (rand.nextBoolean() ? 1 : -1)) * 0.01f) + size_mod));
  		aggression_mod = (float)Math.sqrt((((rand.nextInt (rand.nextInt(degreeOfDiversion*10)+1) * (rand.nextBoolean() ? 1 : -1)) * 0.01f) + 1));
  		obedience_mod = (float)Math.sqrt((((rand.nextInt (rand.nextInt(degreeOfDiversion*10)+1) * (rand.nextBoolean() ? 1 : -1)) * 0.01f) + (1f/aggression_mod)));
  		colour_mod = (float)Math.sqrt((((rand.nextInt (rand.nextInt((degreeOfDiversion+2)*10)+1) * (rand.nextBoolean() ? 1 : -1)) * 0.01f) + 1));
  		hard_mod = (float)Math.sqrt((((rand.nextInt (rand.nextInt(degreeOfDiversion*10)+1) * (rand.nextBoolean() ? 1 : -1)) * 0.01f) + size_mod));
  		climate_mod = (float)Math.sqrt((((rand.nextInt (rand.nextInt(degreeOfDiversion*10)+1) * (rand.nextBoolean() ? 1 : -1)) * 0.01f) + hard_mod));
  		this.setSize(1.4F, 1.6F);
  		this.getNavigator().setAvoidsWater(true);
  		this.tasks.taskEntries.clear();
  		this.tasks.addTask(0, new EntityAISwimming(this));
  		this.tasks.addTask(1, new EntityAIRunAroundLikeCrazy(this, 1.2D));
  		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.tasks.addTask(2, new EntityAIMateTFC(this,this.worldObj, 1.0F));
  		this.tasks.addTask(3, new EntityAIAvoidEntityTFC(this, EntityWolfTFC.class, 8f, 0.5F, 0.7F));
  		this.tasks.addTask(3, new EntityAIAvoidEntityTFC(this, EntityBear.class, 16f, 0.25F, 0.3F));
  		this.tasks.addTask(3, new EntityAITempt(this, 1.2F, TFCItems.WheatGrain, false));
  		this.tasks.addTask(3, new EntityAITempt(this, 1.2F, TFCItems.RyeGrain, false));
  		this.tasks.addTask(3, new EntityAITempt(this, 1.2F, TFCItems.RiceGrain, false));
  		this.tasks.addTask(3, new EntityAITempt(this, 1.2F, TFCItems.BarleyGrain, false));
  		this.tasks.addTask(3, new EntityAITempt(this, 1.2F, TFCItems.OatGrain, false));
  		this.tasks.addTask(6, this.aiEatGrass);
  		this.tasks.addTask(1, new EntityAIPanicTFC(this, 1.2D,true));
  		this.updateChestSaddle();
  
  		//	We hijack the growingAge to hold the day of birth rather
  		//	than number of ticks to next growth event. We want spawned
  		//	animals to be adults, so we set their birthdays far enough back
  		//	in time such that they reach adulthood now.
  		//
  		//this.setGrowingAge((int) TFC_Time.getTotalDays() - getNumberOfDaysToAdult());
  		this.setAge((int) TFC_Time.getTotalDays() - getNumberOfDaysToAdult());
  		//For Testing Only(makes spawned animals into babies)
  		//this.setGrowingAge((int) TFC_Time.getTotalDays());
  	}
  
  	public EntityHorseTFC(World par1World, IAnimal mother,  ArrayList<Float> data)
  	{
  		this(par1World);
  		float father_size = 1;
  		float father_str = 1;
  		float father_aggro = 1;
  		float father_obed = 1;
  		float father_col = 1;
  		float father_clim = 1;
  		float father_hard = 1;
  		for(int i = 0; i < data.size(); i++){
  			switch(i){
  			case 0:father_size = data.get(i);break;
  			case 1:father_str = data.get(i);break;
  			case 2:father_aggro = data.get(i);break;
  			case 3:father_obed = data.get(i);break;
  			case 4:father_col = data.get(i);break;
  			case 5:father_clim = data.get(i);break;
  			case 6:father_hard = data.get(i);break;
  			default:break;
  			}
  		}
  		this.posX = ((EntityLivingBase)mother).posX;
  		this.posY = ((EntityLivingBase)mother).posY;
  		this.posZ = ((EntityLivingBase)mother).posZ;
  		float invSizeRatio = 1f / (2 - dimorphism);
  		size_mod = (float)Math.sqrt(size_mod * size_mod * (float)Math.sqrt((mother.getSize() + father_size) * invSizeRatio));
  		strength_mod = (float)Math.sqrt(strength_mod * strength_mod * (float)Math.sqrt((mother.getStrength() + father_str) * 0.5F));
  		aggression_mod = (float)Math.sqrt(aggression_mod * aggression_mod * (float)Math.sqrt((mother.getAggression() + father_aggro) * 0.5F));
  		obedience_mod = (float)Math.sqrt(obedience_mod * obedience_mod * (float)Math.sqrt((mother.getObedience() + father_obed) * 0.5F));
  		colour_mod = (float)Math.sqrt(colour_mod * colour_mod * (float)Math.sqrt((mother.getColour() + father_col) * 0.5F));
  		hard_mod = (float)Math.sqrt(hard_mod * hard_mod * (float)Math.sqrt((mother.getHardiness() + father_hard) * 0.5F));
  		climate_mod = (float)Math.sqrt(climate_mod * climate_mod * (float)Math.sqrt((mother.getClimateAdaptation() + father_clim) * 0.5F));
  
  
  		this.familiarity = (int) (mother.getFamiliarity()<90?mother.getFamiliarity()/2:mother.getFamiliarity()*0.9f);
  		//	We hijack the growingAge to hold the day of birth rather
  		//	than number of ticks to next growth event.
  		//
  		this.setAge((int) TFC_Time.getTotalDays());
  	}
  
  	@Override
  	public void onLivingUpdate()
  	{
  		//Handle Hunger ticking
  		if (hunger > 168000)
  			hunger = 168000;
  		if (hunger > 0)
  			hunger--;
  
  		if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && rand.nextInt(600) == 0 && !familiarizedToday){
  			this.familiarize(((EntityPlayer)this.riddenByEntity));
  		}
  
  		syncData();
  		if(isAdult())
  			setGrowingAge(0);
  		else
  			setGrowingAge(-1);
  
  
  		this.handleFamiliarityUpdate();
  		if(isPregnant())
  		{
  			if(TFC_Time.getTotalTicks() >= conception + pregnancyRequiredTime)
  			{
  				EntityHorseTFC baby = (EntityHorseTFC) createChildTFC(this);
  				baby.setLocationAndAngles (posX + (rand.nextFloat() - 0.5F) * 2F, posY, posZ + (rand.nextFloat() - 0.5F) * 2F, 0.0F, 0.0F);
  				baby.rotationYawHead = baby.rotationYaw;
  				baby.renderYawOffset = baby.rotationYaw;
  				worldObj.spawnEntityInWorld(baby);
  				baby.setAge((int)TFC_Time.getTotalDays());
  				pregnant = false;
  			}
  		}
  
  		/**
  		 * This Cancels out the changes made to growingAge by EntityAgeable
  		 * */
  		TFC_Core.PreventEntityDataUpdate = true;
  		super.onLivingUpdate();
  		TFC_Core.PreventEntityDataUpdate = false;
  
  		if (hunger > 144000 && rand.nextInt (100) == 0 && getHealth() < TFC_Core.getEntityMaxHealth(this) && !isDead){
  
  			this.heal(1);
  		}
  		else if(hunger < 144000 && super.isInLove()){
  			this.setInLove(false);
  		}
  	}
  
  	private float getPercentGrown(IAnimal animal)
  	{
  		float birth = animal.getBirthDay();
  		float time = (int) TFC_Time.getTotalDays();
  		float percent =(time - birth) / animal.getNumberOfDaysToAdult();
  		return Math.min(percent, 1f);
  	}
  
  	@Override
  	public int increaseTemper(int p_110198_1_)
  	{
  		p_110198_1_*=5; //This is because we want obedience_mod and aggression_mod to have an effect
  		int j = MathHelper.clamp_int(this.getTemper() + (int)(p_110198_1_ * obedience_mod * (1f/aggression_mod)), 0, this.getMaxTemper());
  		this.setTemper(j);
  		return j;
  	}
  
  	@Override
  	public int getMaxTemper()
  	{
  		return (int)(500 * aggression_mod);
  	}
  
  	public void syncData()
  	{
  		if(dataWatcher!= null)
  		{
  			if(!this.worldObj.isRemote)
  			{
  				this.dataWatcher.updateObject(13, Integer.valueOf(sex));
  
  				byte[] values = {
  						TFC_Core.getByteFromSmallFloat(size_mod),
  						TFC_Core.getByteFromSmallFloat(strength_mod),
  						TFC_Core.getByteFromSmallFloat(aggression_mod),
  						TFC_Core.getByteFromSmallFloat(obedience_mod),
  						TFC_Core.getByteFromSmallFloat(colour_mod),
  						TFC_Core.getByteFromSmallFloat(climate_mod),
  						TFC_Core.getByteFromSmallFloat(hard_mod),
  						(byte)familiarity
  				};
  				ByteBuffer buf = ByteBuffer.wrap(values);
  				this.dataWatcher.updateObject(24, buf.getInt());
  				this.dataWatcher.updateObject(23, buf.getInt());
  			}
  			else
  			{
  				sex = this.dataWatcher.getWatchableObjectInt(13);
  
  				ByteBuffer buf = ByteBuffer.allocate(Long.SIZE / Byte.SIZE);
  				buf.putInt(this.dataWatcher.getWatchableObjectInt(24));
  				buf.putInt(this.dataWatcher.getWatchableObjectInt(23));
  				byte[] values = buf.array();
  
  				size_mod = TFC_Core.getSmallFloatFromByte(values[0]);
  				strength_mod = TFC_Core.getSmallFloatFromByte(values[1]);
  				aggression_mod = TFC_Core.getSmallFloatFromByte(values[2]);
  				obedience_mod = TFC_Core.getSmallFloatFromByte(values[3]);
  				colour_mod = TFC_Core.getSmallFloatFromByte(values[4]);
  				climate_mod = TFC_Core.getSmallFloatFromByte(values[5]);
  				hard_mod = TFC_Core.getSmallFloatFromByte(values[6]);
  
  				familiarity = values[7];
  			}
  		}
  	}
  
  	@Override
  	protected void entityInit()
  	{
  		super.entityInit();	
  		this.dataWatcher.addObject(13, new Integer(0)); //sex (1 or 0)
  		this.dataWatcher.addObject(15, Integer.valueOf(0));		//age
  
  		this.dataWatcher.addObject(24, Integer.valueOf(0));	//Size, strength, aggression, obedience. EntityHorse uses 22
  		this.dataWatcher.addObject(23, Integer.valueOf(0));	//Colour, climate, hardiness, familiarity
  	}
  
  	private int func_110225_cC()
  	{
  		int i = this.getHorseType();
  		return this.isChested() && (i == 1 || i == 2) ? 17 : 2;
  	}
  
  	public void updateChestSaddle()
  	{
  		AnimalChest animalchest = this.horseChest;
  		this.horseChest = new AnimalChest("HorseChest", this.func_110225_cC());
  		this.horseChest.func_110133_a(this.getCommandSenderName());
  
  		if (animalchest != null)
  		{
  			animalchest.func_110132_b(this);
  			int i = Math.min(animalchest.getSizeInventory(), this.horseChest.getSizeInventory());
  			for (int j = 0; j < i; ++j)
  			{
  				ItemStack itemstack = animalchest.getStackInSlot(j);
  				if (itemstack != null)
  					this.horseChest.setInventorySlotContents(j, itemstack.copy());
  			}
  			animalchest = null;
  		}
  
  		this.horseChest.func_110134_a(this);
  		this.func_110232_cE();
  	}
  
  	private void func_110232_cE()
  	{
  		if (!this.worldObj.isRemote)
  		{
  			this.setHorseSaddled(this.horseChest.getStackInSlot(0) != null);
  			if (this.func_110259_cr())
  				this.func_146086_d(this.horseChest.getStackInSlot(1));
  		}
  	}
  
  	@Override
  	protected EntityHorseTFC getClosestHorse(Entity entity, double par2)
  	{
  		double d1 = Double.MAX_VALUE;
  		Entity entity1 = null;
  		List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(entity, entity.boundingBox.addCoord(par2, par2, par2), horseBreedingSelector);
  