Skip to content

Commit

Permalink
Fix quantum bridge infinite update loop (#7558)
Browse files Browse the repository at this point in the history
Account for quantum bridge nodes not being initialized when neighbor updates trigger multiblock updates.
Stop swallowing exceptions during multiblock updates, since that hid this problem for years, preventing it from being fixed.

---------

Co-authored-by: Sebastian Hartte <shartte@users.noreply.github.com>
(cherry picked from commit 332da22)
  • Loading branch information
shBLOCK authored and shartte committed Jan 14, 2024
1 parent db8f155 commit 68fd215
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.lwjgl.PointerBuffer;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.util.tinyfd.TinyFileDialogs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.PauseScreen;
Expand Down Expand Up @@ -50,6 +52,8 @@
@OnlyIn(Dist.CLIENT)
public class GuidebookStructureCommands {

private static final Logger LOG = LoggerFactory.getLogger(GuidebookStructureCommands.class);

@Nullable
private static String lastOpenedOrSavedPath;

Expand Down Expand Up @@ -106,6 +110,7 @@ private static void importStructure(ServerLevel level, BlockPos origin) {
try {
compound = NbtUtils.snbtToStructure(textInFile);
} catch (CommandSyntaxException e) {
LOG.error("Failed to parse structure.", e);
player.sendSystemMessage(Component.literal(e.toString()));
return null;
}
Expand All @@ -127,6 +132,7 @@ private static void importStructure(ServerLevel level, BlockPos origin) {
player.sendSystemMessage(Component.literal("Placed structure"));
}
} catch (Exception e) {
LOG.error("Failed to place structure.", e);
player.sendSystemMessage(Component.literal(e.toString()));
}

Expand Down Expand Up @@ -212,6 +218,7 @@ private static void exportStructure(ServerLevel level, BlockPos origin, Vec3i si

player.sendSystemMessage(Component.literal("Saved structure"));
} catch (IOException e) {
LOG.error("Failed to save structure.", e);
player.sendSystemMessage(Component.literal(e.toString()));
}

Expand Down
4 changes: 0 additions & 4 deletions src/main/java/appeng/me/cluster/MBCalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;

import appeng.core.AELog;

public abstract class MBCalculator<TBlockEntity extends IAEMultiBlock<TCluster>, TCluster extends IAECluster> {

/**
Expand Down Expand Up @@ -145,8 +143,6 @@ public void calculateMultiblock(ServerLevel level, BlockPos loc) {
cluster.updateStatus(updateGrid);
return;
}
} catch (Throwable err) {
AELog.debug(err);
} finally {
setModificationInProgress(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,7 @@ private boolean canUseNode(long qe) {
}

private boolean isActive() {
if (this.isDestroyed || !this.registered) {
return false;
}

return this.hasQES();
return !this.isDestroyed && this.registered && hasQES() && getNode() != null;
}

private IGridNode getNode() {
Expand Down

0 comments on commit 68fd215

Please sign in to comment.