From dfd3f8af171958deac1fad78a24647a02fc6741c Mon Sep 17 00:00:00 2001 From: alessio Date: Wed, 2 Sep 2026 15:38:54 +0200 Subject: [PATCH 1/2] Fix : Breaking the ME Bridge block while it has an active crafting job linked to a crafting CPU crashes the server with: Ticking grid on end of server tick --- .../blocks/blockentities/MEBridgeEntity.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/de/srendi/advancedperipherals/common/blocks/blockentities/MEBridgeEntity.java b/src/main/java/de/srendi/advancedperipherals/common/blocks/blockentities/MEBridgeEntity.java index fdeb82732..d86e28e04 100644 --- a/src/main/java/de/srendi/advancedperipherals/common/blocks/blockentities/MEBridgeEntity.java +++ b/src/main/java/de/srendi/advancedperipherals/common/blocks/blockentities/MEBridgeEntity.java @@ -60,27 +60,27 @@ protected MEBridgePeripheral buildPeripheral() { @Override public void handleTick(Level level, BlockState state, BlockEntityType type) { super.handleTick(level, state, type); - if (level.isClientSide()) { - return; - } - if (!initialized) { - initialized = true; - mainNode.setFlags(GridFlags.REQUIRE_CHANNEL); - mainNode.setIdlePowerUsage(APConfig.PERIPHERALS_CONFIG.meConsumption.get()); - mainNode.setVisualRepresentation(new ItemStack(APBlocks.ME_BRIDGE.get())); - mainNode.setInWorldNode(true); - mainNode.create(level, getBlockPos()); - MEBridgePeripheral peripheral = this.getPeripheral(); - if (peripheral != null) { - peripheral.setNode(mainNode); + if (!level.isClientSide()) { + if (!initialized) { + initialized = true; + mainNode.setFlags(GridFlags.REQUIRE_CHANNEL) + .setIdlePowerUsage(APConfig.PERIPHERALS_CONFIG.meConsumption.get()) + .setVisualRepresentation(new ItemStack(APBlocks.ME_BRIDGE.get())) + .setInWorldNode(true) + .addService(MEBridgeEntity.class, this) + .create(level, getBlockPos()); + MEBridgePeripheral peripheral = this.getPeripheral(); + if (peripheral != null) { + peripheral.setNode(mainNode); + } } - } - // Try to start the job if the job calculation finished - jobs.forEach(AECraftJob::tick); + // Try to start the job if the job calculation finished + jobs.forEach(AECraftJob::tick); - // Remove the job if the crafting started, we can't do anything with it anymore - jobs.removeIf(AECraftJob::canBePurged); + // Remove the job if the crafting started, we can't do anything with it anymore + jobs.removeIf(AECraftJob::canBePurged); + } } @Override From 6bb803bcd2b7192134dccb2e650879fba2e6c2e3 Mon Sep 17 00:00:00 2001 From: alessio Date: Wed, 2 Sep 2026 18:20:27 +0200 Subject: [PATCH 2/2] Fix : Breaking the ME Bridge block while it has an active crafting job linked to a crafting CPU crashes the server with: Ticking grid on end of server tick --- .../blocks/blockentities/MEBridgeEntity.java | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/main/java/de/srendi/advancedperipherals/common/blocks/blockentities/MEBridgeEntity.java b/src/main/java/de/srendi/advancedperipherals/common/blocks/blockentities/MEBridgeEntity.java index d86e28e04..9a0ae02de 100644 --- a/src/main/java/de/srendi/advancedperipherals/common/blocks/blockentities/MEBridgeEntity.java +++ b/src/main/java/de/srendi/advancedperipherals/common/blocks/blockentities/MEBridgeEntity.java @@ -46,6 +46,7 @@ public class MEBridgeEntity extends PeripheralBlockEntity im private boolean initialized = false; private final IManagedGridNode mainNode = GridHelper.createManagedNode(this, MEBridgeEntityListener.INSTANCE); + public MEBridgeEntity(BlockPos pos, BlockState state) { super(APBlockEntityTypes.ME_BRIDGE.get(), pos, state); getMainNode().setExposedOnSides(getGridConnectableSides(null)); @@ -60,27 +61,28 @@ protected MEBridgePeripheral buildPeripheral() { @Override public void handleTick(Level level, BlockState state, BlockEntityType type) { super.handleTick(level, state, type); - if (!level.isClientSide()) { - if (!initialized) { - initialized = true; - mainNode.setFlags(GridFlags.REQUIRE_CHANNEL) - .setIdlePowerUsage(APConfig.PERIPHERALS_CONFIG.meConsumption.get()) - .setVisualRepresentation(new ItemStack(APBlocks.ME_BRIDGE.get())) - .setInWorldNode(true) - .addService(MEBridgeEntity.class, this) - .create(level, getBlockPos()); - MEBridgePeripheral peripheral = this.getPeripheral(); - if (peripheral != null) { - peripheral.setNode(mainNode); - } + if (level.isClientSide()) { + return; + } + if (!initialized) { + initialized = true; + mainNode.setFlags(GridFlags.REQUIRE_CHANNEL) + .setIdlePowerUsage(APConfig.PERIPHERALS_CONFIG.meConsumption.get()) + .setVisualRepresentation(new ItemStack(APBlocks.ME_BRIDGE.get())) + .setInWorldNode(true) + .addService(ICraftingRequester.class, this) + .create(level, getBlockPos()); + MEBridgePeripheral peripheral = this.getPeripheral(); + if (peripheral != null) { + peripheral.setNode(mainNode); } + } - // Try to start the job if the job calculation finished - jobs.forEach(AECraftJob::tick); + // Try to start the job if the job calculation finished + jobs.forEach(AECraftJob::tick); - // Remove the job if the crafting started, we can't do anything with it anymore - jobs.removeIf(AECraftJob::canBePurged); - } + // Remove the job if the crafting started, we can't do anything with it anymore + jobs.removeIf(AECraftJob::canBePurged); } @Override