Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class CoreTileEntityBlock extends CoreBlock
- {
- public static final PropertyDirection FACING = PropertyDirection.create(Names.NBT.Direction, EnumFacing.Plane.HORIZONTAL);
- public CoreTileEntityBlock(Material material, String Name)
- {
- super(material, Name);
- }
- public CoreTileEntityBlock(String Name)
- {
- super(Name);
- }
- @Override
- public abstract TileEntity createTileEntity(World world, IBlockState state);
- public <T extends CoreTileEntity> T GetTileEntity(IBlockAccess world, BlockPos pos)
- {
- return (T) world.getTileEntity(pos);
- }
- @Override
- public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
- {
- world.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);
- }
- @Override
- public IBlockState getStateFromMeta(int meta)
- {
- return getDefaultState().withProperty(FACING, EnumFacing.getFront((meta & 3) + 2));
- }
- @Override
- public int getMetaFromState(IBlockState state)
- {
- return state.getValue(FACING).getIndex() - 2;
- }
- @Override
- protected BlockStateContainer createBlockState()
- {
- return new BlockStateContainer(this, FACING);
- }
- }
Add Comment
Please, Sign In to add comment