Fix alarm shape

This commit is contained in:
drcrazy 2019-05-01 00:40:14 +03:00
parent e01e9398ea
commit 2794c813eb

View file

@ -66,19 +66,20 @@ public class BlockAlarm extends BaseTileBlock {
public BlockAlarm() { public BlockAlarm() {
super(Block.Properties.create(Material.ROCK)); super(Block.Properties.create(Material.ROCK));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH).with(ACTIVE, false)); this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH).with(ACTIVE, false));
this.shape = GenCuboidShapes(0.19, 0.81); this.shape = GenCuboidShapes(3, 10);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/lighting")); RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/lighting"));
BlockWrenchEventHandler.wrenableBlocks.add(this); BlockWrenchEventHandler.wrenableBlocks.add(this);
} }
private VoxelShape[] GenCuboidShapes(double depth, double width) { private VoxelShape[] GenCuboidShapes(double depth, double width) {
double culling = (16.0D - width) / 2 ;
VoxelShape[] shapes = { VoxelShape[] shapes = {
Block.makeCuboidShape(width, 1.0 - depth, width, 1.0 - width, 1.0D, 1.0 - width), Block.makeCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
Block.makeCuboidShape(width, 0.0D, width, 1.0 - width, depth, 1.0 - width), Block.makeCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
Block.makeCuboidShape(width, width, 1.0 - depth, 1.0 - width, 1.0 - width, 1.0D), Block.makeCuboidShape(culling, culling, 16.0 - depth, 16.0 - culling, 16.0 - culling, 16.0D),
Block.makeCuboidShape(width, width, 0.0D, 1.0 - width, 1.0 - width, depth), Block.makeCuboidShape(culling, culling, 0.0D, 16.0 - culling, 16.0 - culling, depth),
Block.makeCuboidShape(1.0 - depth, width, width, 1.0D, 1.0 - width, 1.0 - width), Block.makeCuboidShape(16.0 - depth, culling, culling, 16.0D, 16.0 - culling, 16.0 - culling),
Block.makeCuboidShape(0.0D, width, width, depth, 1.0 - width, 1.0 - width), Block.makeCuboidShape(0.0D, culling, culling, depth, 16.0 - culling, 16.0 - culling),
}; };
return shapes; return shapes;
} }
@ -169,7 +170,6 @@ public class BlockAlarm extends BaseTileBlock {
@Override @Override
public VoxelShape getShape(IBlockState state, IBlockReader worldIn, BlockPos pos) { public VoxelShape getShape(IBlockState state, IBlockReader worldIn, BlockPos pos) {
// TODO: Fix this
return shape[getFacing(state).getIndex()]; return shape[getFacing(state).getIndex()];
} }
} }