-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into latest
- Loading branch information
Showing
19 changed files
with
152 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
## Changes | ||
- Added forge support | ||
- Added 3d compass rendering to config gui | ||
- Added toggle3dCompass subcommand | ||
- Added 3d compass toggle keybind | ||
|
||
## New Features | ||
- It is now possible to render a 3d compass client-side in the world |
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
64 changes: 64 additions & 0 deletions
64
common/src/main/java/dev/boxadactle/coordinatesdisplay/CompassRenderer3D.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,64 @@ | ||
package dev.boxadactle.coordinatesdisplay; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import dev.boxadactle.boxlib.math.geometry.Vec3; | ||
import dev.boxadactle.boxlib.rendering.Renderer3D; | ||
import dev.boxadactle.boxlib.rendering.renderers.TextRenderer; | ||
import dev.boxadactle.boxlib.util.ClientUtils; | ||
import dev.boxadactle.boxlib.util.GuiUtils; | ||
import dev.boxadactle.boxlib.util.WorldUtils; | ||
import net.minecraft.client.Camera; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.network.chat.Component; | ||
|
||
public class CompassRenderer3D extends Renderer3D<CompassRenderer3D> { | ||
public CompassRenderer3D() { | ||
super(false); | ||
} | ||
|
||
@Override | ||
public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, double v, double v1, double v2) { | ||
if (WorldUtils.getCamera() != null && CoordinatesDisplay.getConfig().render3dCompass) { | ||
float size = 0.15f; | ||
|
||
Camera camera = ClientUtils.getClient().gameRenderer.getMainCamera(); | ||
net.minecraft.world.phys.Vec3 cameraPos = camera.getPosition(); | ||
|
||
TextRenderer north = new TextRenderer(false) | ||
.setPos(new Vec3<>(cameraPos.x, cameraPos.y + 1.0, cameraPos.z - 10.0)) | ||
.setText(Component.literal("N")) | ||
.setSize(size) | ||
.setColor(GuiUtils.RED) | ||
.setCentered(true) | ||
.setXray(true); | ||
north.render(poseStack, multiBufferSource, v, v1, v2); | ||
|
||
TextRenderer east = new TextRenderer(false) | ||
.setPos(new Vec3<>(cameraPos.x + 10.0, cameraPos.y + 1.0, cameraPos.z)) | ||
.setText(Component.literal("E")) | ||
.setSize(size) | ||
.setColor(GuiUtils.GREEN) | ||
.setCentered(true) | ||
.setXray(true); | ||
east.render(poseStack, multiBufferSource, v, v1, v2); | ||
|
||
TextRenderer south = new TextRenderer(false) | ||
.setPos(new Vec3<>(cameraPos.x, cameraPos.y + 1.0, cameraPos.z + 10.0)) | ||
.setText(Component.literal("S")) | ||
.setSize(size) | ||
.setColor(GuiUtils.YELLOW) | ||
.setCentered(true) | ||
.setXray(true); | ||
south.render(poseStack, multiBufferSource, v, v1, v2); | ||
|
||
TextRenderer west = new TextRenderer(false) | ||
.setPos(new Vec3<>(cameraPos.x - 10.0, cameraPos.y + 1.0, cameraPos.z)) | ||
.setText(Component.literal("W")) | ||
.setSize(size) | ||
.setColor(GuiUtils.WHITE) | ||
.setCentered(true) | ||
.setXray(true); | ||
west.render(poseStack, multiBufferSource, v, v1, v2); | ||
} | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.