aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-10-13 21:09:29 +0200
committerLinnea Gräf <nea@nea.moe>2025-10-13 21:09:29 +0200
commit05160314e6899ece75779dbd2e5b691ed581c2b9 (patch)
tree1a510d4d8d3fe692b980a4762b3634874d5d7dc2 /src/main/kotlin/util
parent0d903f93d35410a81f7be073511487903ff49516 (diff)
downloadFirmament-05160314e6899ece75779dbd2e5b691ed581c2b9.tar.gz
Firmament-05160314e6899ece75779dbd2e5b691ed581c2b9.tar.bz2
Firmament-05160314e6899ece75779dbd2e5b691ed581c2b9.zip
feat: add debug mode to custom block texture areas
Diffstat (limited to 'src/main/kotlin/util')
-rw-r--r--src/main/kotlin/util/render/RenderInWorldContext.kt11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/kotlin/util/render/RenderInWorldContext.kt b/src/main/kotlin/util/render/RenderInWorldContext.kt
index 12a061d..b1ba9d0 100644
--- a/src/main/kotlin/util/render/RenderInWorldContext.kt
+++ b/src/main/kotlin/util/render/RenderInWorldContext.kt
@@ -7,7 +7,9 @@ import util.render.CustomRenderLayers
import kotlin.math.pow
import net.minecraft.client.render.Camera
import net.minecraft.client.render.RenderLayer
+import net.minecraft.client.render.RenderLayers
import net.minecraft.client.render.RenderTickCounter
+import net.minecraft.client.render.TexturedRenderLayers
import net.minecraft.client.render.VertexConsumer
import net.minecraft.client.render.VertexConsumerProvider
import net.minecraft.client.texture.Sprite
@@ -15,6 +17,7 @@ import net.minecraft.client.util.math.MatrixStack
import net.minecraft.text.Text
import net.minecraft.util.Identifier
import net.minecraft.util.math.BlockPos
+import net.minecraft.util.math.Box
import net.minecraft.util.math.Vec3d
import moe.nea.firmament.events.WorldRenderLastEvent
import moe.nea.firmament.util.FirmFormatters
@@ -34,6 +37,14 @@ class RenderInWorldContext private constructor(
matrixStack.pop()
}
+ fun box(aabb: Box, color: Int) {
+ matrixStack.push()
+ matrixStack.translate(aabb.minX, aabb.minY, aabb.minZ)
+ matrixStack.scale(aabb.lengthX.toFloat(), aabb.lengthY.toFloat(), aabb.lengthZ.toFloat())
+ buildCube(matrixStack.peek().positionMatrix, vertexConsumers.getBuffer(CustomRenderLayers.COLORED_QUADS), color)
+ matrixStack.pop()
+ }
+
fun sharedVoxelSurface(blocks: Set<BlockPos>, color: Int) {
val m = BlockPos.Mutable()
val l = vertexConsumers.getBuffer(CustomRenderLayers.COLORED_QUADS)