Skip to content

Commit

Permalink
Change quickTeleport limit (Related to #10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrix-Shen committed Mar 19, 2024
1 parent e92eafd commit bcdd81f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/com/plusls/xma/util/QuickTeleportUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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));

Expand Down

0 comments on commit bcdd81f

Please sign in to comment.