Skip to content

Commit

Permalink
Add gui button to teleport to waypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
UnRealDinnerbone committed Jul 3, 2024
1 parent ddf374c commit 96485f1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 96485f1

Please sign in to comment.