From 090fb1a33e70bba52fdc02a5a4faed2b7439399a Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Sun, 30 Jan 2022 15:40:18 +0100 Subject: [PATCH 1/2] Prevent console NPE & speed up by not using catch/throw --- src/main/java/com/volmit/iris/core/tools/IrisCreator.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/volmit/iris/core/tools/IrisCreator.java b/src/main/java/com/volmit/iris/core/tools/IrisCreator.java index c83cff617..3581832e5 100644 --- a/src/main/java/com/volmit/iris/core/tools/IrisCreator.java +++ b/src/main/java/com/volmit/iris/core/tools/IrisCreator.java @@ -125,11 +125,10 @@ public class IrisCreator { { int req = 441; Supplier g = () -> { - try { - return finalAccess1.getEngine().getGenerated(); - } catch(Throwable e) { + if (finalAccess1 == null || finalAccess1.getEngine() == null) { return 0; } + return finalAccess1.getEngine().getGenerated(); }; while(g.get() < req) { double v = (double) g.get() / (double) req; @@ -138,7 +137,7 @@ public class IrisCreator { sender.sendProgress(v, "Generating"); J.sleep(16); } else { - sender.sendMessage(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - finalAccess1.getEngine().getGenerated()) + " Left)"))); + sender.sendMessage(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - g.get()) + " Left)"))); J.sleep(1000); } } From 0642e5a67ed5d954a9facabee77b78c0c440ed76 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Tue, 25 Jan 2022 15:39:43 +0100 Subject: [PATCH 2/2] Revert "Enable edit context" This reverts commit df2c1ca6f2ccbf24bc51b4a1a3513ae2b75fbaff. --- .../java/com/volmit/iris/core/commands/CommandEdit.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/volmit/iris/core/commands/CommandEdit.java b/src/main/java/com/volmit/iris/core/commands/CommandEdit.java index 9f8aea066..e1cb05399 100644 --- a/src/main/java/com/volmit/iris/core/commands/CommandEdit.java +++ b/src/main/java/com/volmit/iris/core/commands/CommandEdit.java @@ -57,7 +57,7 @@ public class CommandEdit implements DecreeExecutor { @Decree(description = "Edit the biome you specified", aliases = {"b"}, origin = DecreeOrigin.PLAYER) - public void biome(@Param(contextual = true, description = "The biome to edit") IrisBiome biome) { + public void biome(@Param(contextual = false, description = "The biome to edit") IrisBiome biome) { if(noStudio()) { return; } @@ -75,7 +75,7 @@ public class CommandEdit implements DecreeExecutor { } @Decree(description = "Edit the region you specified", aliases = {"r"}, origin = DecreeOrigin.PLAYER) - public void region(@Param(contextual = true, description = "The region to edit") IrisRegion region) { + public void region(@Param(contextual = false, description = "The region to edit") IrisRegion region) { if(noStudio()) { return; } @@ -93,7 +93,7 @@ public class CommandEdit implements DecreeExecutor { } @Decree(description = "Edit the dimension you specified", aliases = {"d"}, origin = DecreeOrigin.PLAYER) - public void dimension(@Param(contextual = true, description = "The dimension to edit") IrisDimension dimension) { + public void dimension(@Param(contextual = false, description = "The dimension to edit") IrisDimension dimension) { if(noStudio()) { return; }