From bcdd81fa91a5ae7648a6b2195abbbc604b6cdfba Mon Sep 17 00:00:00 2001 From: Hendrix-Shen Date: Tue, 19 Mar 2024 22:51:42 +0800 Subject: [PATCH] Change quickTeleport limit (Related to #10) --- .../com/plusls/xma/util/QuickTeleportUtil.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/plusls/xma/util/QuickTeleportUtil.java b/src/main/java/com/plusls/xma/util/QuickTeleportUtil.java index 00738d6..ac30d76 100644 --- a/src/main/java/com/plusls/xma/util/QuickTeleportUtil.java +++ b/src/main/java/com/plusls/xma/util/QuickTeleportUtil.java @@ -16,6 +16,10 @@ public static boolean teleport(KeyAction keyAction, IKeybind iKeybind) { if (!(Minecraft.getInstance().screen instanceof GuiMap)) { return false; } + + if (Minecraft.getInstance().player == null) { + return false; + } GuiMap guiMap = ((GuiMap) Minecraft.getInstance().screen); MapDimension currentDimension = ((AccessorGuiMap) guiMap).getMapProcessor().getMapWorld().getCurrentDimension(); @@ -31,18 +35,14 @@ public static boolean teleport(KeyAction keyAction, IKeybind iKeybind) { int mouseBlockPosY = ((AccessorGuiMap) guiMap).getMouseBlockPosY(); int mouseBlockPosZ = ((AccessorGuiMap) guiMap).getMouseBlockPosZ(); + //#if MC > 11502 // Disable teleport feature if xaero map denied or mouseBlockPos cannot get. - if ( - //#if MC > 11502 - !((AccessorGuiMap) guiMap).getMapProcessor().getMapWorld().isTeleportAllowed() || - //#endif - mouseBlockPosY == 32767 - ) { + if (!((AccessorGuiMap) guiMap).getMapProcessor().getMapWorld().isTeleportAllowed()) { return false; } - - InfoUtil.sendCommand(String.format("tp @s %s %s %s", mouseBlockPosX, Minecraft.getInstance().player == null ? - mouseBlockPosY : Minecraft.getInstance().player.getBlockYCompat(), mouseBlockPosZ)); + //#endif + InfoUtil.sendCommand(String.format("tp @s %s %s %s", mouseBlockPosX, mouseBlockPosY == 32767 ? + Minecraft.getInstance().player.getBlockYCompat() : mouseBlockPosY, mouseBlockPosZ)); Minecraft.getInstance().getSoundManager() .play(SimpleSoundInstance.forUI(SoundEvents.CHORUS_FRUIT_TELEPORT, 1.0F));