Skip to content

Commit

Permalink
Merge pull request #306 from FTBTeam/feature/1.20.1/more-backport
Browse files Browse the repository at this point in the history
[1.20.1] Backport Waypoint manager and pointer icon
  • Loading branch information
desht authored Jul 16, 2024
2 parents bd3929a + fdd2105 commit 647c1dd
Show file tree
Hide file tree
Showing 7 changed files with 363 additions and 283 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public interface FTBChunksWorldConfig {
SNBTConfig WAYPOINT_SHARING = CONFIG.addGroup("waypoint_sharing");
BooleanValue WAYPOINT_SHARING_SERVER = WAYPOINT_SHARING.addBoolean("waypoint_sharing_server", true).comment("Allow players to share waypoints with the entire server.");
BooleanValue WAYPOINT_SHARING_PARTY = WAYPOINT_SHARING.addBoolean("waypoint_sharing_party", true).comment("Allow players to share waypoints with their party.");
BooleanValue WAYPOINT_SHARING_TEAM = WAYPOINT_SHARING.addBoolean("waypoint_sharing_players", true).comment("Allow players to share waypoints with other players.");
BooleanValue WAYPOINT_SHARING_PLAYERS = WAYPOINT_SHARING.addBoolean("waypoint_sharing_players", true).comment("Allow players to share waypoints with other players.");

static int getMaxClaimedChunks(ChunkTeamData playerData, ServerPlayer player) {
if (player != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import dev.ftb.mods.ftbchunks.client.gui.AddWaypointOverlay;
import dev.ftb.mods.ftbchunks.client.gui.ChunkScreen;
import dev.ftb.mods.ftbchunks.client.gui.LargeMapScreen;
import dev.ftb.mods.ftbchunks.client.gui.PointerIcon;
import dev.ftb.mods.ftbchunks.client.gui.WaypointEditorScreen;
import dev.ftb.mods.ftbchunks.client.map.*;
import dev.ftb.mods.ftbchunks.client.map.color.ColorUtils;
Expand Down Expand Up @@ -1089,6 +1090,7 @@ private void mapIcons(MapIconEvent event) {

if (!event.getMapType().isMinimap()) {
event.add(new EntityMapIcon(mc.player, FaceIcon.getFace(mc.player.getGameProfile())));
event.add(new PointerIcon());
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package dev.ftb.mods.ftbchunks.client.gui;

import com.mojang.math.Axis;
import dev.ftb.mods.ftbchunks.api.FTBChunksAPI;
import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon;
import dev.ftb.mods.ftbchunks.api.client.icon.MapType;
import dev.ftb.mods.ftblibrary.icon.Icon;
import dev.ftb.mods.ftblibrary.ui.BaseScreen;
import dev.ftb.mods.ftblibrary.ui.input.Key;
import dev.ftb.mods.ftblibrary.ui.input.MouseButton;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.Vec3;

public class PointerIcon implements MapIcon {

private static final Icon POINTER = Icon.getIcon(FTBChunksAPI.rl("textures/player.png"));

@Override
public Vec3 getPos(float partialTick) {
Player player = Minecraft.getInstance().player;
return partialTick >= 1F ? player.position() : player.getPosition(partialTick);
}

@Override
public boolean onMousePressed(BaseScreen screen, MouseButton button) {
return false;
}

@Override
public boolean onKeyPressed(BaseScreen screen, Key key) {
return false;
}

@Override
public void draw(MapType mapType, GuiGraphics graphics, int x, int y, int w, int h, boolean outsideVisibleArea, int iconAlpha) {
Player player = Minecraft.getInstance().player;
graphics.pose().pushPose();
graphics.pose().translate(x + w / 2f, y + h / 2f, 0F);
graphics.pose().scale(2f, 2f, 2f);
graphics.pose().mulPose(Axis.ZP.rotationDegrees(player.getYRot() + 180F));
POINTER.draw(graphics, - w / 2, -h / 2, w, h);
graphics.pose().popPose();
}
}
Loading

0 comments on commit 647c1dd

Please sign in to comment.