Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.techmage.magetech.block;
- import net.minecraft.block.properties.PropertyDirection;
- import net.minecraft.block.state.BlockState;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.BlockPos;
- import net.minecraft.util.EnumFacing;
- import net.minecraft.world.World;
- public class _PROTOTYPE_BLOCK_ROTATION extends BlockMageTech
- {
- public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
- public _PROTOTYPE_BLOCK_ROTATION()
- {
- useNeighborBrightness = true;
- setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
- }
- @Override
- public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
- {
- worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()));
- }
- @Override
- public IBlockState getStateFromMeta(int meta)
- {
- EnumFacing facing = EnumFacing.getFront(meta);
- if (facing.getAxis() == EnumFacing.Axis.Y)
- facing = EnumFacing.NORTH;
- return getDefaultState().withProperty(FACING, facing);
- }
- @Override
- public int getMetaFromState(IBlockState state)
- {
- return state.getValue(FACING).getIndex();
- }
- @Override
- protected BlockState createBlockState()
- {
- return new BlockState(this, FACING);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement