package micdoodle8.mods.galacticraft.planets.asteroids.blocks; import micdoodle8.mods.galacticraft.core.blocks.BlockTileGC; import micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityMinerBase; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; import java.util.Random; public class BlockMinerBaseFull extends BlockTileGC { public BlockMinerBaseFull(String assetName) { super(Material.rock); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); this.setStepSound(soundTypeMetal); } @Override public int getRenderType() { return -1; } @Override public int damageDropped(IBlockState state) { return 0; } @Override public int quantityDropped(IBlockState state, int fortune, Random random) { return 1; } @Override public boolean isOpaqueCube() { return false; } @Override public TileEntity createTileEntity(World world, IBlockState state) { return new TileEntityMinerBase(); } @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getStateFromMeta(0); //TODO //return this.getMetadataFromAngle(world, x, y, z, side); } @Override public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) { //TODO /* if (this.getMetadataFromAngle(world, x, y, z, side) != -1) { return true; } */ return true; } @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntity tileEntity = worldIn.getTileEntity(pos); if (tileEntity instanceof TileEntityMinerBase) { ((TileEntityMinerBase) tileEntity).onBlockRemoval(); } super.breakBlock(worldIn, pos, state); } @Override public boolean onMachineActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntity tileEntity = worldIn.getTileEntity(pos); if (tileEntity instanceof TileEntityMinerBase) { return ((TileEntityMinerBase) tileEntity).onActivated(playerIn); } else { return false; } } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(AsteroidBlocks.blockMinerBase); } @Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { ArrayList<ItemStack> ret = new ArrayList<ItemStack>(); ret.add(new ItemStack(Item.getItemFromBlock(AsteroidBlocks.blockMinerBase), 8, 0)); return ret; } @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(Item.getItemFromBlock(AsteroidBlocks.blockMinerBase), 1, 0); } @Override public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntity te = world.getTileEntity(pos); if (te instanceof TileEntityMinerBase) { ((TileEntityMinerBase) te).updateFacing(); } return true; } @Override @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT; } }