From 9821925594b6e993996cb5682889ccfc456f2ad3 Mon Sep 17 00:00:00 2001 From: Adris Jautakas Date: Sun, 19 Sep 2021 14:51:19 -0400 Subject: [PATCH] Duct tape Bizarre nullpointerexception that shouldn't happen, will need to investigate later as this may cause problems elsewhere. --- .../altoclef/tasks/DefaultGoToDimensionTask.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/adris/altoclef/tasks/DefaultGoToDimensionTask.java b/src/main/java/adris/altoclef/tasks/DefaultGoToDimensionTask.java index 7553d8efc..485a6962d 100644 --- a/src/main/java/adris/altoclef/tasks/DefaultGoToDimensionTask.java +++ b/src/main/java/adris/altoclef/tasks/DefaultGoToDimensionTask.java @@ -114,14 +114,10 @@ private Task goToNetherFromOverworldTask(AltoClef mod) { setDebugState("Going to nether portal"); return new EnterNetherPortalTask(Dimension.NETHER); } - switch (mod.getModSettings().getOverworldToNetherBehaviour()) { - case BUILD_PORTAL_VANILLA: - return new ConstructNetherPortalBucketTask(); - case GO_TO_HOME_BASE: - return new GetToBlockTask(mod.getModSettings().getHomeBasePosition()); - } - setDebugState("Overworld->Nether Behaviour " + mod.getModSettings().getOverworldToNetherBehaviour() + " is NOT IMPLEMENTED YET!"); - return null; + return switch (mod.getModSettings().getOverworldToNetherBehaviour()) { + case BUILD_PORTAL_VANILLA -> new ConstructNetherPortalBucketTask(); + case GO_TO_HOME_BASE -> new GetToBlockTask(mod.getModSettings().getHomeBasePosition()); + }; } private Task goToEndTask(AltoClef mod) { @@ -133,7 +129,7 @@ private Task goToEndTask(AltoClef mod) { private boolean netherPortalIsClose(AltoClef mod) { if (mod.getBlockTracker().anyFound(Blocks.NETHER_PORTAL)) { BlockPos closest = mod.getBlockTracker().getNearestTracking(mod.getPlayer().getPos(), Blocks.NETHER_PORTAL); - return closest.isWithinDistance(mod.getPlayer().getPos(), 2000); + return closest != null && closest.isWithinDistance(mod.getPlayer().getPos(), 2000); } return false; }