From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Thu, 28 Sep 2023 17:07:02 +0800 Subject: [PATCH] CCE update suppression diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java index b7c1050dfafa79f3ed86524ce37cd06651cbbdd9..b01918fc97926a3182c21145bb7411e7bc409d35 100644 --- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java @@ -182,7 +182,7 @@ public class ShulkerBoxBlock extends BaseEntityBlock { protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { if (!state.is(newState.getBlock())) { BlockEntity blockEntity = world.getBlockEntity(pos); - super.onRemove(state, world, pos, newState, moved); + if (!org.leavesmc.leaves.LeavesConfig.modify.oldMC.oldBlockEntityBehaviour) super.onRemove(state, world, pos, newState, moved); // Leaves - behaviour 1.21.1- if (blockEntity instanceof ShulkerBoxBlockEntity) { world.updateNeighbourForOutputSignal(pos, state.getBlock()); } @@ -239,17 +239,21 @@ public class ShulkerBoxBlock extends BaseEntityBlock { @Override protected int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) { - // Leaves start - fix update suppression crash + // Leaves start - fix update suppression crash - and cce fix if (org.leavesmc.leaves.LeavesConfig.modify.updateSuppressionCrashFix) { try { - return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos)); + return org.leavesmc.leaves.LeavesConfig.modify.oldMC.updater.cceUpdateSuppression ? + AbstractContainerMenu.getRedstoneSignalFromContainer((net.minecraft.world.Container) world.getBlockEntity(pos)) : + AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos)); } catch (ClassCastException ex) { throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, this); } } else { - return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos)); + return org.leavesmc.leaves.LeavesConfig.modify.oldMC.updater.cceUpdateSuppression ? + AbstractContainerMenu.getRedstoneSignalFromContainer((net.minecraft.world.Container) world.getBlockEntity(pos)) : + AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos)); } - // Leaves end - fix update suppression crash + // Leaves end - fix update suppression crash - and cce fix } @Override