diff --git a/CHANGELOG.md b/CHANGELOG.md index fabf7a86..198028a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +* Added gui button to teleport to way point + ## [2100.1.0] ### Changed diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java index 99821ff2..552ef429 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java @@ -1,16 +1,19 @@ package dev.ftb.mods.ftbchunks.client.mapicon; import com.mojang.blaze3d.systems.RenderSystem; +import dev.architectury.networking.NetworkManager; import dev.ftb.mods.ftbchunks.api.client.icon.MapType; import dev.ftb.mods.ftbchunks.api.client.icon.WaypointIcon; import dev.ftb.mods.ftbchunks.client.gui.LargeMapScreen; import dev.ftb.mods.ftbchunks.client.map.WaypointImpl; +import dev.ftb.mods.ftbchunks.net.TeleportFromMapPacket; import dev.ftb.mods.ftblibrary.config.ColorConfig; import dev.ftb.mods.ftblibrary.config.StringConfig; import dev.ftb.mods.ftblibrary.icon.Color4I; import dev.ftb.mods.ftblibrary.icon.Icon; import dev.ftb.mods.ftblibrary.icon.Icons; import dev.ftb.mods.ftblibrary.icon.ImageIcon; +import dev.ftb.mods.ftblibrary.icon.ItemIcon; import dev.ftb.mods.ftblibrary.math.MathUtils; import dev.ftb.mods.ftblibrary.ui.BaseScreen; import dev.ftb.mods.ftblibrary.ui.ColorSelectorPanel; @@ -19,9 +22,13 @@ import dev.ftb.mods.ftblibrary.ui.input.MouseButton; import dev.ftb.mods.ftblibrary.util.TooltipList; import net.minecraft.client.Minecraft; +import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.commands.Commands; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; +import net.minecraft.world.item.Items; import org.lwjgl.glfw.GLFW; import java.util.ArrayList; @@ -96,6 +103,14 @@ private void openWPContextMenu(LargeMapScreen screen) { contextMenu.add(makeTitleMenuItem()); contextMenu.add(ContextMenuItem.SEPARATOR); + LocalPlayer player = Minecraft.getInstance().player; + if(player.hasPermissions(Commands.LEVEL_GAMEMASTERS)) { + contextMenu.add(new ContextMenuItem(Component.translatable("ftbchunks.gui.teleport"), ItemIcon.getItemIcon(Items.ENDER_PEARL), b -> { + NetworkManager.sendToServer(new TeleportFromMapPacket(waypoint.getPos().above(), false, waypoint.getDimension())); + screen.closeGui(false); + })); + } + contextMenu.add(new ContextMenuItem(Component.translatable("gui.rename"), Icons.CHAT, b -> { StringConfig config = new StringConfig(); config.setValue(waypoint.getName()); diff --git a/gradle.properties b/gradle.properties index 3991007a..c196133a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ minecraft_version=1.21 # Deps #forge_version=50.0.9 -neoforge_version=21.0.10-beta +neoforge_version=21.0.14-beta # https://maven.neoforged.net/#/releases/net/neoforged/fancymodloader/loader neoforge_loader_version=4