Skip to content

Commit

Permalink
Stop swallowing errors in Multiblock calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Jan 14, 2024
1 parent 8e378e1 commit 9528ba5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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 @@ -103,7 +103,7 @@ public void updateStatus(boolean updateGrid) {
if (myOtherSide instanceof QuantumCluster sideB) {
var sideA = this;

if (sideA.isActive() && sideB.isActive() && sideA.getNode() != null && sideB.getNode() != null) {
if (sideA.isActive() && sideB.isActive()) {
if (this.connection != null && this.connection.getConnection() != null) {
final IGridNode a = this.connection.getConnection().a();
final IGridNode b = this.connection.getConnection().b();
Expand Down 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 9528ba5

Please sign in to comment.