-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #306 from FTBTeam/feature/1.20.1/more-backport
[1.20.1] Backport Waypoint manager and pointer icon
- Loading branch information
Showing
7 changed files
with
363 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/PointerIcon.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
Oops, something went wrong.