-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugSomething isn't workingSomething isn't workingfixa fix is either in progress or already implemented for future versionsa fix is either in progress or already implemented for future versions
Description
Minecraft: 1.20.1 (Fabric) and 1.20.4 (Fabric)
Reframed: 1.6.6
The game crashes if a block is placed automatically via a block placer.
The Player Entity in the
BlockItem.writeNbtToBlockEntity(World world, @Nullable PlayerEntity player, BlockPos pos, ItemStack stack)method might be null and is null if a block is placed with a block placer from Energized Power.
The fix is relatively easy.
You just need to check for null in this method
| private static void placeBlockWithOffHandCamo(World world, PlayerEntity player, BlockPos pos, ItemStack stack, CallbackInfoReturnable<Boolean> cir, @Local LocalRef<NbtCompound> compound) { |
A simple solution would be to add the check as the first statement in the if check:
if (player == null || compound.get() != null
|| player.getOffHandStack().isEmpty()
|| player.getMainHandStack().isEmpty()
|| !(player.getMainHandStack().getItem() instanceof BlockItem frame)
|| !(frame.getBlock() instanceof ReFramedBlock)
|| !(player.getOffHandStack().getItem() instanceof BlockItem block)
|| block.getBlock() instanceof BlockEntityProvider
|| (world.getBlockState(pos).contains(Properties.LAYERS) && world.getBlockState(pos).get(Properties.LAYERS) > 1)
|| !Block.isShapeFullCube(block.getBlock().getDefaultState().getCollisionShape(world, pos))
) return;Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixa fix is either in progress or already implemented for future versionsa fix is either in progress or already implemented for future versions