Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BlockFaceRotBase extends BlockBase implements IHasModel
- {
- public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
- public BlockFaceRotBase(String name, Material material, float hardness, float resistance, String tool, int level, CreativeTabs tabs, SoundType sound)
- {
- super(tool, material, resistance, resistance, tool, level, tabs, sound);
- BlocksBrickInit.BLOCKS.add(this);
- BlockMetalInit.BLOCKS.add(this);
- ItemInit.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName()));
- this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
- }
- @Override
- public void registerModels()
- {
- CustomBlocks.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory");
- }
- @Override
- public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
- {
- IBlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer);
- state = state.withProperty(FACING, placer.getHorizontalFacing().getOpposite());
- return state;
- }
- @Override
- public IBlockState getStateFromMeta(int meta)
- { return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)); }
- @Override
- public int getMetaFromState(IBlockState state)
- { return ((EnumFacing) state.getValue(FACING)).getHorizontalIndex(); }
- @Override
- protected BlockStateContainer createBlockState()
- { return new BlockStateContainer(this, new IProperty[] { FACING }); }
- }
Advertisement
Add Comment
Please, Sign In to add comment