Created
September 6, 2024 15:34
-
-
Save Densamisten/db3bc8da1553b90477f98c8d72245a2c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| WorldRenderEvents.AFTER_ENTITIES.register(context -> { | |
| MatrixStack matrices = context.matrixStack(); | |
| matrices.push(); | |
| // Use the correct render layer for drawing lines (does not require UVs) | |
| VertexConsumer buffer = context.consumers().getBuffer(RenderLayer.getLines()); | |
| // Get the player's current position | |
| PlayerEntity player = MinecraftClient.getInstance().player; | |
| Vec3d playerPos = player.getPos(); | |
| // Place the box near the player (slightly above for visibility) | |
| double boxX = playerPos.getX(); | |
| double boxY = playerPos.getY() + 2; | |
| double boxZ = playerPos.getZ(); | |
| float size = 1.0f; // Set a reasonable size for the box | |
| // Draw the box at the new position | |
| WorldRenderer.drawBox( | |
| matrices, buffer, | |
| boxX - size / 2, boxY - size / 2, boxZ - size / 2, // Min coordinates | |
| boxX + size / 2, boxY + size / 2, boxZ + size / 2, // Max coordinates | |
| 1.0f, 0.0f, 0.0f, 1.0f // Red color with full opacity | |
| ); | |
| matrices.pop(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment