From 942dd629efbf12183b1c5f5a966c36d4b0647a6b Mon Sep 17 00:00:00 2001 From: nea Date: Sun, 7 May 2023 12:22:36 +0200 Subject: Add fishing particle highlighter Currently does not work when sneaking or when the bobber moves too much, since the position desyncs with the server --- .../kotlin/moe/nea/notenoughupdates/util/render/block.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/main/kotlin/moe/nea/notenoughupdates/util/render') diff --git a/src/main/kotlin/moe/nea/notenoughupdates/util/render/block.kt b/src/main/kotlin/moe/nea/notenoughupdates/util/render/block.kt index 5fc70ef..0d6c63b 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/util/render/block.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/util/render/block.kt @@ -11,6 +11,7 @@ import net.minecraft.client.render.VertexFormat import net.minecraft.client.render.VertexFormats import net.minecraft.client.util.math.MatrixStack import net.minecraft.util.math.BlockPos +import net.minecraft.util.math.Vec3d class RenderBlockContext private constructor(private val tesselator: Tessellator, private val matrixStack: MatrixStack) { private val buffer = tesselator.buffer @@ -21,7 +22,16 @@ class RenderBlockContext private constructor(private val tesselator: Tessellator fun block(blockPos: BlockPos) { matrixStack.push() matrixStack.translate(blockPos.x.toFloat(), blockPos.y.toFloat(), blockPos.z.toFloat()) - RenderSystem.setShader(GameRenderer::getPositionColorProgram) + buildCube(matrixStack.peek().positionMatrix, buffer) + tesselator.draw() + matrixStack.pop() + } + + fun tinyBlock(vec3d: Vec3d, size: Float) { + matrixStack.push() + matrixStack.translate(vec3d.x, vec3d.y, vec3d.z) + matrixStack.scale(size, size, size) + matrixStack.translate(-.5, -.5, -.5) buildCube(matrixStack.peek().positionMatrix, buffer) tesselator.draw() matrixStack.pop() @@ -74,6 +84,7 @@ class RenderBlockContext private constructor(private val tesselator: Tessellator RenderSystem.disableDepthTest() RenderSystem.enableBlend() RenderSystem.defaultBlendFunc() + RenderSystem.setShader(GameRenderer::getPositionColorProgram) matrices.push() matrices.translate(-camera.pos.x, -camera.pos.y, -camera.pos.z) -- cgit