Outline won't match cable model exactly. Closes #1804

This commit is contained in:
drcrazy 2019-08-22 14:54:48 +03:00
parent 7d4c88cbd5
commit 9f22ddf686
2 changed files with 10 additions and 3 deletions

View file

@ -170,15 +170,16 @@ public class BlockCable extends BlockWithEntity {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, EntityContext entityContext) {
if (type != null) {
double culling = type.cableThickness / 2;
// outline is 1px bigger then model to ease selection
double culling = type.cableThickness - 1;
return Block.createCuboidShape(culling, culling, culling, 16.0D - culling, 16.0D - culling,
16.0D - culling);
}
return Block.createCuboidShape(6, 6, 6, 10, 10, 10);
return Block.createCuboidShape(4, 4, 4, 12, 12, 12);
}
@Override

View file

@ -26,6 +26,7 @@ package techreborn.blocks.lighting;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderLayer;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
@ -139,6 +140,11 @@ public class BlockLamp extends BaseBlockEntityProvider {
return BlockRenderLayer.CUTOUT;
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Override
public boolean activate(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);