Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/main/java/alexiil/mc/lib/multipart/impl/MultipartBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,25 @@ public BlockEntity createBlockEntity(BlockView var1) {

@Override
public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
BlockEntity be = view.getBlockEntity(pos);
if (be instanceof MultipartBlockEntity) {
MultipartBlockEntity container = (MultipartBlockEntity) be;
return container.container.getCollisionShape();
if (view != null) {
BlockEntity be = view.getBlockEntity(pos);
if (be instanceof MultipartBlockEntity) {
MultipartBlockEntity container = (MultipartBlockEntity) be;
return container.container.getCollisionShape();
}
}
return MISSING_PARTS_SHAPE;
}

@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
BlockEntity be = view.getBlockEntity(pos);
if (be instanceof MultipartBlockEntity) {
if (be instanceof MultipartBlockEntity && view instanceof World) {
MultipartBlockEntity container = (MultipartBlockEntity) be;

if (LibMultiPart.isDrawingBlockOutlines.getAsBoolean()) {
Vec3d hitVec = MinecraftClient.getInstance().crosshairTarget.getPos();
return getPartOutlineShape(state, (World) view, pos, hitVec);
return getPartOutlineShape(state, (World)view, pos, hitVec);
}

return container.container.getOutlineShape();
Expand Down