package net.mcft.copy.betterstorage.client.model;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;

@SideOnly(Side.CLIENT)
public class ModelBackpackArmor extends ModelBiped {
	
	public static final ModelBackpackArmor instance = new ModelBackpackArmor();
	
	private ModelRenderer main;
	private ModelRenderer top;
	private ModelRenderer front;
	
	public ModelBackpackArmor() {
		
		textureWidth = 32;
		textureHeight = 32;
		
		main = new ModelRenderer(this, 0, 8);
		main.addBox(-5F, 4F, 2F, 10, 9, 5);
		main.setRotationPoint(0F, 0F, 0F);
		
		top = new ModelRenderer(this, 0, 0);
		top.addBox(-5F, 1F, 2F, 10, 3, 5);
		top.setRotationPoint(0F, 0F, 0F);
		
		front = new ModelRenderer(this, 0, 22);
		front.addBox(-4F, 6F, 7F, 8, 6, 2);
		front.setRotationPoint(0F, 0F, 0F);
		
	}
	
	@Override
	public void render(Entity entity, float v1, float v2, float v3, float v4, float v5, float v6) {
		setRotationAngles(v1, v2, v3, v4, v5, v6, entity);
		float foo = 1 / 20.0F;
		main.render(foo);
		top.render(foo);
		front.render(foo);
	}
	
	@Override
	public void setRotationAngles(float v1, float v2, float v3, float v4, float v5, float v6, Entity entity) {
		// For some reason this is not properly updated.
		isSneak = ((EntityLiving)entity).isSneaking();
		
		super.setRotationAngles(v1, v2, v3, v4, v5, v6, entity);
		
		main.rotateAngleX = top.rotateAngleX = front.rotateAngleX = bipedBody.rotateAngleX;
		main.rotateAngleY = top.rotateAngleY = front.rotateAngleY = bipedBody.rotateAngleY;
		main.rotateAngleZ = top.rotateAngleZ = front.rotateAngleZ = bipedBody.rotateAngleZ;
	}
	
}

@@ -737,19 +737,47 @@
 F, 0F);%0A
+%09%09bipedBody.addChild(main);%0A
 %09%09%0A
-
 %09%09top = 
@@ -876,24 +876,51 @@
 F, 0F, 0F);%0A
+%09%09bipedBody.addChild(top);%0A
 %09%09%0A%09%09front =
@@ -1028,16 +1028,45 @@
 F, 0F);%0A
+%09%09bipedBody.addChild(front);%0A
 %09%09%0A%09%7D%0A%09%0A
@@ -1257,52 +1257,17 @@
 ;%0A%09%09
-main.render(foo);%0A%09%09top.render(foo);%0A%09%09front
+bipedBody
 .ren
@@ -1500,19 +1500,16 @@
 king();%0A
-%09%09%0A
 %09%09super.
@@ -1563,269 +1563,8 @@
 y);%0A
-%09%09%0A%09%09main.rotateAngleX = top.rotateAngleX = front.rotateAngleX = bipedBody.rotateAngleX;%0A%09%09main.rotateAngleY = top.rotateAngleY = front.rotateAngleY = bipedBody.rotateAngleY;%0A%09%09main.rotateAngleZ = top.rotateAngleZ = front.rotateAngleZ = bipedBody.rotateAngleZ;%0A
 %09%7D%0A%09

Support for Smart Moving (??)