package hmggirlfront.block.tile;
 
import hmggirlfront.mod_GirlFront;
import hmggirlfront.entity.mob.EntityIBC01;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.util.ITickable;
 
public class TileEntity_Base_Fieldhospital extends TileEntity_BaseBase implements ITickable
{
	
	
    @Override
	public void update() {
    	Block block = this.world.getBlockState(this.pos).getBlock();
        Entity entity = null;
        int x = this.pos.getX();
        int y= this.pos.getY();
        int z = this.pos.getZ();
        super.update();
        this.inv_name = "hmggirlfront.bdoll_base_fieldhospital.name";
        if(this.world.getBlockState(this.pos).getBlock() == mod_GirlFront.bdoll_base_fieldhospital_em) {
        	enemy = true; 
        	invmaxcount = 600;
             inv_tex = "inv_m_em.png";
             enemyblock = true;
             invclearblock = mod_GirlFront.bdoll_base_fieldhospital;
        }else {
        	 enemy = false;
        	 invmaxcount = 600;
             inv_tex = "inv_m.png";
             enemyblock = false;
             invclearblock = mod_GirlFront.bdoll_base_fieldhospital_em;
        }
       
        if(enemy) {
        	++count;
            if(count > 300) {
    			if (this.canspawn(x, y, z, 20) && !this.world.isRemote) {
    				int i = this.world.rand.nextInt(5);
    		        for(int ii = 0; ii < i; ++ii){
    		        	int ix = this.world.rand.nextInt(8);
    					int iz = this.world.rand.nextInt(8);
    		        	EntityIBC01 entityskeleton = new EntityIBC01(this.world);
    		        	entityskeleton.setLocationAndAngles(x - 4 +ix, y+1, z - 4 +iz, 0, 0.0F);
    			        this.world.spawnEntity(entityskeleton);
    		        }
    			}
    			count = 0;
            }
        }
        
	}

}