package erebus.blocks; import net.minecraft.block.BlockLog; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import erebus.ModTabs; public class BlockLogErebus extends BlockLog { public BlockLogErebus() { setHarvestLevel("axe", 0); setCreativeTab(ModTabs.BLOCKS); Blocks.FIRE.setFireInfo(this, 5, 5); setDefaultState(blockState.getBaseState().withProperty(LOG_AXIS, BlockLog.EnumAxis.Y)); } @Override public IBlockState getStateFromMeta(int meta) { IBlockState state = getDefaultState(); switch (meta & 12) { case 0: state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y); break; case 4: state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.X); break; case 8: state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z); break; default: state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE); } return state; } @Override @SuppressWarnings("incomplete-switch") public int getMetaFromState(IBlockState state) { int meta = 0; switch (state.getValue(LOG_AXIS)) { case X: meta |= 4; break; case Z: meta |= 8; break; case NONE: meta |= 12; break; } return meta; } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] { LOG_AXIS }); } @Override public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) { /*if (!world.isRemote && wood.name() == "Rotten") if (world.rand.nextInt(30) == 0) { EntityWoodlouse entity = new EntityWoodlouse(world); entity.setLocationAndAngles(x + 0.5D, y, z + 0.5D, 0.0F, 0.0F); world.spawnEntityInWorld(entity); } else if (world.rand.nextInt(30) == 0) { EntityBeetleLarva entity = new EntityBeetleLarva(world); entity.setLocationAndAngles(x + 0.5D, y, z + 0.5D, 0.0F, 0.0F); world.spawnEntityInWorld(entity); } else if (world.rand.nextInt(30) == 0) { EntitySilverfish entity = new EntitySilverfish(world); entity.setLocationAndAngles(x + 0.5D, y, z + 0.5D, 0.0F, 0.0F); world.spawnEntityInWorld(entity); }*/ super.onBlockDestroyedByPlayer(world, pos, state); } }