Open JDDev0 opened 2 months ago
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 https://github.com/DriHut/ReFramed/blob/e592db1ea2ada2cede7911cd7e45bf6f61ac9e91/src/main/java/fr/adrien1106/reframed/mixin/BlockItemMixin.java#L34
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;
Good to know! will be fixed when I add the slopes.
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
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 https://github.com/DriHut/ReFramed/blob/e592db1ea2ada2cede7911cd7e45bf6f61ac9e91/src/main/java/fr/adrien1106/reframed/mixin/BlockItemMixin.java#L34
A simple solution would be to add the check as the first statement in the if check: