package hmggirlfront.entity;

import hmggirlfront.items.ItemDollGunBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import objmodel.IModelCustom;

public class GFEntityID_Dummy {

	public EntityDoll_Dummy doll;
	
	public GFEntityID_Dummy(EntityDoll_Dummy d) {
		doll = d;
	}
	
	public int getID() {
		int id = 0;
		ItemStack item = doll.getHeldItemMainhand();
		boolean flag = !item.isEmpty();
		if(flag && doll != null) {
			if(item.getItem() instanceof ItemDollGunBase) {
				ItemDollGunBase dollgun = (ItemDollGunBase) item.getItem();
				id = dollgun.dollid;
				doll.setCustomNameTag(dollgun.dollname);
			}
			
			/*if(item.getItem() instanceof ItemGunBase) {
				if(item.getItem() == mod_GirlFront.dollgun_m1911) {
					id = 2;
					doll.setCustomNameTag("M1911");
				}
				if(item.getItem() == mod_GirlFront.dollgun_m14) {
					id = 37;
					doll.setCustomNameTag("M14");
				}
				if(item.getItem() == mod_GirlFront.dollgun_t97) {
					id = 130;
					doll.setCustomNameTag("TYPE97");
				}
				if(item.getItem() == mod_GirlFront.dollgun_t100) {
					id = 228;
					doll.setCustomNameTag("TYPE100");
				}
			}*/
		}
		
		return id;
	}
	@SideOnly(Side.CLIENT)
	public IModelCustom getModel() {
		IModelCustom id = null;
		ItemStack item = doll.getHeldItemMainhand();
		boolean flag = !item.isEmpty();
		if(flag && doll != null) {
			if(item.getItem() instanceof ItemDollGunBase) {
				ItemDollGunBase dollgun = (ItemDollGunBase) item.getItem();
				id = dollgun.doll_model_h[doll.getDummyID()];
			}
		}
		return id;
	}
	@SideOnly(Side.CLIENT)
	public ResourceLocation getModelTex() {
		ResourceLocation id = null;
		ItemStack item = doll.getHeldItemMainhand();
		boolean flag = !item.isEmpty();
		if(flag && doll != null) {
			if(item.getItem() instanceof ItemDollGunBase) {
				ItemDollGunBase dollgun = (ItemDollGunBase) item.getItem();
				id = new ResourceLocation(dollgun.doll_tex_h[doll.getDummyID()]);
			}
		}
		return id;
	}
}
