Updated block wrenching
This commit is contained in:
parent
77e1c54b86
commit
c409b67c3c
8 changed files with 151 additions and 112 deletions
|
@ -77,7 +77,39 @@ public class BlockLamp extends BaseTileBlock {
|
|||
this.brightness = brightness;
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/lighting"));
|
||||
}
|
||||
|
||||
public static boolean isActive(IBlockState state) {
|
||||
return state.getValue(ACTIVE);
|
||||
}
|
||||
|
||||
public static EnumFacing getFacing(IBlockState state) {
|
||||
if(!state.getProperties().containsKey(FACING)){
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
return state.getValue(FACING);
|
||||
}
|
||||
|
||||
public static void setFacing(EnumFacing facing, World world, BlockPos pos) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
|
||||
}
|
||||
|
||||
public static void setActive(Boolean active, World world, BlockPos pos) {
|
||||
EnumFacing facing = (EnumFacing)world.getBlockState(pos).getValue(FACING);
|
||||
IBlockState state = world.getBlockState(pos).withProperty(ACTIVE, active).withProperty(FACING, facing);
|
||||
world.setBlockState(pos, state, 3);
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
// BaseTileBlock
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World world, final int meta) {
|
||||
return new TileLamp();
|
||||
}
|
||||
|
||||
// Block
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
FACING = PropertyDirection.create("facing");
|
||||
|
@ -85,11 +117,6 @@ public class BlockLamp extends BaseTileBlock {
|
|||
return new BlockStateContainer(this, FACING, ACTIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World world, final int meta) {
|
||||
return new TileLamp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
|
||||
|
@ -148,29 +175,4 @@ public class BlockLamp extends BaseTileBlock {
|
|||
EnumFacing facing = EnumFacing.getFront(meta&7);
|
||||
return this.getDefaultState().withProperty(FACING, facing).withProperty(ACTIVE, active);
|
||||
}
|
||||
|
||||
public static boolean isActive(IBlockState state) {
|
||||
return state.getValue(ACTIVE);
|
||||
}
|
||||
|
||||
public static EnumFacing getFacing(IBlockState state) {
|
||||
if(!state.getProperties().containsKey(FACING)){
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
return state.getValue(FACING);
|
||||
}
|
||||
|
||||
public static void setFacing(EnumFacing facing, World world, BlockPos pos) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
|
||||
}
|
||||
|
||||
public static void setActive(Boolean active, World world, BlockPos pos) {
|
||||
EnumFacing facing = (EnumFacing)world.getBlockState(pos).getValue(FACING);
|
||||
IBlockState state = world.getBlockState(pos).withProperty(ACTIVE, active).withProperty(FACING, facing);
|
||||
world.setBlockState(pos, state, 3);
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue