From 322f2fca3091943e7ff08834d5cdcc1486d0c450 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 30 Nov 2023 22:19:57 +0100 Subject: code cleanup --- .../skyhanni/features/garden/GardenPlotBorders.kt | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt index 409caaa85..7ab485aa8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt @@ -45,60 +45,60 @@ object GardenPlotBorders { event.render(plot, LorenzColor.YELLOW.toColor(), LorenzColor.DARK_BLUE.toColor()) } - fun LorenzRenderWorldEvent.render(plot: GardenPlotAPI.Plot, LINE_COLOR: Color, cornerColor: Color) { - val event = this + fun LorenzRenderWorldEvent.render(plot: GardenPlotAPI.Plot, lineColor: Color, cornerColor: Color) { // These don't refer to Minecraft chunks but rather garden plots, but I use // the word chunk as the logic closely represents how chunk borders are rendered in latter mc versions - val chunkX = floor((plot.middle.x + 48) / 96).toInt() - val chunkZ = floor((plot.middle.z + 48) / 96).toInt() - val chunkMinX = (chunkX * 96) - 48 - val chunkMinZ = (chunkZ * 96) - 48 + val plotSize = 96 + val chunkX = floor((plot.middle.x + 48) / plotSize).toInt() + val chunkZ = floor((plot.middle.z + 48) / plotSize).toInt() + val chunkMinX = (chunkX * plotSize) - 48 + val chunkMinZ = (chunkZ * plotSize) - 48 // Lowest point in the garden val minHeight = 66 val maxHeight = 256 // Render 4 vertical corners - for (i in 0..96 step 96) { - for (j in 0..96 step 96) { + for (i in 0..plotSize step plotSize) { + for (j in 0..plotSize step plotSize) { val start = LorenzVec(chunkMinX + i, minHeight, chunkMinZ + j) val end = LorenzVec(chunkMinX + i, maxHeight, chunkMinZ + j) - event.tryDraw3DLine(start, end, cornerColor, 2, true) + tryDraw3DLine(start, end, cornerColor, 2, true) } } // Render vertical on X-Axis - for (x in 4..<96 step 4) { + for (x in 4.. (minX, minZ + 96) - event.tryDraw3DLine(start, start.addZ(96), LINE_COLOR, 1, true) + tryDraw3DLine(start, start.addZ(plotSize), lineColor, 1, true) // (minX, minZ + 96) -> (minX + 96, minZ + 96) - event.tryDraw3DLine(start.addZ(96), start.addXZ(96, 96), LINE_COLOR, 1, true) + tryDraw3DLine(start.addZ(plotSize), start.addXZ(plotSize, plotSize), lineColor, 1, true) // (minX + 96, minZ + 96) -> (minX + 96, minZ) - event.tryDraw3DLine(start.addXZ(96, 96), start.addX(96), LINE_COLOR, 1, true) + tryDraw3DLine(start.addXZ(plotSize, plotSize), start.addX(plotSize), lineColor, 1, true) // (minX + 96, minZ) -> (minX, minZ) - event.tryDraw3DLine(start.addX(96), start, LINE_COLOR, 1, true) + tryDraw3DLine(start.addX(plotSize), start, lineColor, 1, true) } } -- cgit