package hmggirlfront.block.tile;
 
import hmggirlfront.mod_GirlFront;
import hmggirlfront.entity.mob.EntityIBC07;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ITickable;
 
public class TileEntity_Base_Oil_complex 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_oil_complex.name";
        this.base_boss = true;
        if(this.world.getBlockState(this.pos).getBlock() == mod_GirlFront.bdoll_base_oil_complex_em) {
        	enemy = true; 
        	invmaxcount = 1200;
             inv_tex = "inv_m_em.png";
             enemyblock = true;
             invclearblock = mod_GirlFront.bdoll_base_oil_complex;
        }else {
        	 enemy = false;
        	 invmaxcount = 1200;
             inv_tex = "inv_m.png";
             enemyblock = false;
             invclearblock = mod_GirlFront.bdoll_base_oil_complex_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);
    					EntityIBC07 entityskeleton = new EntityIBC07(this.world);
    		        	entityskeleton.setLocationAndAngles(x - 4 +ix, y+1, z - 4 +iz, 0, 0.0F);
    		        	entityskeleton.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(mod_GirlFront.dollgun_ibc07hg));
    		        	entityskeleton.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, new ItemStack(mod_GirlFront.dollgun_ibc07sd));
    			        this.world.spawnEntity(entityskeleton);
    		        }
    			}
    			count = 0;
            }
        }
        
	}

}