package hmggirlfront.entity;

import gvclib.entity.living.EntityGVCLivingBase;
import gvclib.entity.living.ISoldier;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.world.World;

public class EntityDollBase extends EntityGVCLivingBase implements IAnimals, ISoldier {

	private static final DataParameter<Integer> squadid = 
    		EntityDataManager.<Integer>createKey(EntityDollBase.class, DataSerializers.VARINT);
 private static final DataParameter<Integer> pledge = 
    		EntityDataManager.<Integer>createKey(EntityDollBase.class, DataSerializers.VARINT);
 
 private static final DataParameter<Integer> parachute = 
    		EntityDataManager.<Integer>createKey(EntityDollBase.class, DataSerializers.VARINT);
	
	public EntityDollBase(World worldIn) {
		super(worldIn);
	}

	
	
	/**0 == HG:
	 * 1 == SMG:
	 * 2 == AR:
	 * 3 == RF:
	 * 4 == MG:
	 * 5 == SG:
	 * 6 == GL
	 * 7 == HL*/
	public int gun_class = 0;
	
	public int evasion = 0;
	public int evasion_base = 0;
	public int power = 0;
	public int power_base = 0;
	public String bullet_type_am = "";
	public float bure = 0;
	public float bure_base = 0;
	public int rpm = 0;
	public int rpm_base = 0;
	public int pellet = 1;
	public int pellet_base = 1;
	
	
	public float doll_size = 1.0F;
	
	public int doll_armor = 0;
	public int doll_armorbase = 0;
	
	/**　回復速度*/
	public int doll_hp_recovery = 40;
	
	public Item bullet_type = null;
	public String bullet_type_tab = "";
	
	public int doll_heal_time = 0;
	
	public int doll_skill = 0;
	public boolean doll_skill_can = true;
	public int doll_autoskill = 0;
	
	public ItemStack mainitem = new ItemStack((Item)null);// = nullはだめっぽい
	
	
	 public String sound;
	 public String modid;
	 
	 public boolean reset = true;
	 
	 
	 public boolean drone_inv = false;
	 public int drone_inv_count = 0;
	 
	 
	 public boolean on_meve = false;
	 
	 public int mediccount = 0;
	 
	 public void writeEntityToNBT(NBTTagCompound compound)
	    {
	        super.writeEntityToNBT(compound);
	        NBTTagList nbttaglist = new NBTTagList();
	        compound.setInteger("squadid", getSquadID());
	        compound.setInteger("pledge", getPledge());
	        
	        compound.setInteger("parachute", getParachute());
	    }
		public void readEntityFromNBT(NBTTagCompound compound)
	    {
	        super.readEntityFromNBT(compound);
	        this.setSquadID(compound.getInteger("squadid"));
	        this.setPledge(compound.getInteger("pledge"));
	        
	        this.setParachute(compound.getInteger("parachute"));
	    }
		protected void entityInit()
	    {
	    	super.entityInit();
	    	this.dataManager.register(squadid, Integer.valueOf(1));
	    	this.dataManager.register(pledge, Integer.valueOf(0));
	    	
	    	this.dataManager.register(parachute, Integer.valueOf(0));
	    }
		public int getSquadID() {
	    		return ((this.dataManager.get(squadid)).intValue());
	    	}

	    public void setSquadID(int stack) {
	    		this.dataManager.set(squadid, Integer.valueOf(stack));
	    }
	    
		public int getPledge() {
			return ((this.dataManager.get(pledge)).intValue());
		}

		public void setPledge(int stack) {
			this.dataManager.set(pledge, Integer.valueOf(stack));
		}
		
		
		public int getParachute() {
			return ((this.dataManager.get(parachute)).intValue());
		}

		public void setParachute(int stack) {
			this.dataManager.set(parachute, Integer.valueOf(stack));
		}
}
