aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt6
3 files changed, 18 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt
index 08af9199f..df276f468 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils.getCorners
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils
@@ -121,15 +122,10 @@ class CrystalHollowsWalls {
}
private fun drawNucleus(event: LorenzRenderWorldEvent) {
- val southEastCorner = LorenzVec(nucleusBBInflate.minX, nucleusBBInflate.minY, nucleusBBInflate.minZ)
- val southWestCorner = LorenzVec(nucleusBBInflate.minX, nucleusBBInflate.minY, nucleusBBInflate.maxZ)
- val northEastCorner = LorenzVec(nucleusBBInflate.maxX, nucleusBBInflate.minY, nucleusBBInflate.minZ)
- val northWestCorner = LorenzVec(nucleusBBInflate.maxX, nucleusBBInflate.minY, nucleusBBInflate.maxZ)
-
- val southWestTopCorner = LorenzVec(nucleusBBInflate.minX, nucleusBBInflate.maxY, nucleusBBInflate.maxZ)
- val southEastTopCorner = LorenzVec(nucleusBBInflate.minX, nucleusBBInflate.maxY, nucleusBBInflate.minZ)
- val northEastTopCorner = LorenzVec(nucleusBBInflate.maxX, nucleusBBInflate.maxY, nucleusBBInflate.minZ)
- val northWestTopCorner = LorenzVec(nucleusBBInflate.maxX, nucleusBBInflate.maxY, nucleusBBInflate.maxZ)
+ val (southEastCorner, southWestCorner, northEastCorner, northWestCorner) = nucleusBBInflate
+ .getCorners(nucleusBBInflate.minY)
+ val (southWestTopCorner, southEastTopCorner, northEastTopCorner, northWestTopCorner) = nucleusBBInflate
+ .getCorners(nucleusBBInflate.maxY)
RenderUtils.QuadDrawer.draw3D(event.partialTicks) {
draw(
@@ -193,7 +189,7 @@ class CrystalHollowsWalls {
isMinXEsleMaxX: Boolean,
isMinZElseMaxZ: Boolean,
color1: Color,
- color2: Color
+ color2: Color,
) {
val nucleusX = if (isMinXEsleMaxX) nucleusBBExpand.minX else nucleusBBExpand.maxX
val middleX = if (isMinXEsleMaxX) middleX.shiftNX() else middleX.shiftPX()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 05ea212b1..d07f3b149 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -27,6 +27,7 @@ import net.minecraft.client.gui.inventory.GuiEditSign
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.SharedMonsterAttributes
import net.minecraft.launchwrapper.Launch
+import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.ChatComponentText
import net.minecraftforge.fml.common.FMLCommonHandler
import java.text.DecimalFormat
@@ -362,4 +363,13 @@ object LorenzUtils {
|| inAdvancedMiningIsland()
fun isBetaVersion() = UpdateManager.isCurrentlyBeta()
+
+ fun AxisAlignedBB.getCorners(y: Double): List<LorenzVec> {
+ val cornerOne = LorenzVec(minX, y, minZ)
+ val cornerTwo = LorenzVec(minX, y, maxZ)
+ val cornerThree = LorenzVec(maxX, y, maxZ)
+ val cornerFour = LorenzVec(maxX, y, minZ)
+
+ return listOf(cornerOne, cornerTwo, cornerThree, cornerFour)
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index fb97a8357..7d37953b1 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -18,6 +18,7 @@ import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.CollectionUtils.zipWithNext3
import at.hannibal2.skyhanni.utils.ColorUtils.getFirstColorCode
import at.hannibal2.skyhanni.utils.LorenzColor.Companion.toLorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils.getCorners
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.renderXAligned
import at.hannibal2.skyhanni.utils.shader.ShaderManager
@@ -1508,10 +1509,7 @@ object RenderUtils {
colour: Color,
depth: Boolean,
) {
- val cornerOne = LorenzVec(boundingBox.minX, boundingBox.maxY, boundingBox.minZ)
- val cornerTwo = LorenzVec(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ)
- val cornerThree = LorenzVec(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ)
- val cornerFour = LorenzVec(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ)
+ val (cornerOne, cornerTwo, cornerThree, cornerFour, ) = boundingBox.getCorners(boundingBox.maxY)
this.draw3DLine(cornerOne, cornerTwo, colour, lineWidth, depth)
this.draw3DLine(cornerTwo, cornerThree, colour, lineWidth, depth)
this.draw3DLine(cornerThree, cornerFour, colour, lineWidth, depth)