aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-05-25 17:54:35 -0500
committeringlettronald <inglettronald@gmail.com>2023-05-25 17:54:35 -0500
commite645175075b28d13266650ec00f6d5b7927133bf (patch)
tree145701d4173ac2658f7f8fa870320f23e9de635f
parent1cc4b53862eb60e892b8c5cf1190b8cd6a62d32b (diff)
downloadDulkirMod-e645175075b28d13266650ec00f6d5b7927133bf.tar.gz
DulkirMod-e645175075b28d13266650ec00f6d5b7927133bf.tar.bz2
DulkirMod-e645175075b28d13266650ec00f6d5b7927133bf.zip
better interpolation
-rw-r--r--src/main/java/dulkirmod/mixins/AccessorRenderManager.java18
-rw-r--r--src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt81
-rw-r--r--src/main/kotlin/dulkirmod/features/rift/IchorHighlight.kt10
-rw-r--r--src/main/kotlin/dulkirmod/features/rift/SteakDisplay.kt14
-rw-r--r--src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt17
5 files changed, 115 insertions, 25 deletions
diff --git a/src/main/java/dulkirmod/mixins/AccessorRenderManager.java b/src/main/java/dulkirmod/mixins/AccessorRenderManager.java
new file mode 100644
index 0000000..303f3ea
--- /dev/null
+++ b/src/main/java/dulkirmod/mixins/AccessorRenderManager.java
@@ -0,0 +1,18 @@
+package dulkirmod.mixins;
+
+import net.minecraft.client.renderer.entity.RenderManager;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+@Mixin(RenderManager.class)
+public interface AccessorRenderManager {
+
+ @Accessor("renderPosX")
+ double getRenderX();
+
+ @Accessor("renderPosY")
+ double getRenderY();
+
+ @Accessor("renderPosZ")
+ double getRenderZ();
+} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt b/src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt
index c3fbfb5..318c617 100644
--- a/src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt
+++ b/src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt
@@ -1,6 +1,8 @@
package dulkirmod.features
+import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.DulkirConfig
+import dulkirmod.mixins.AccessorRenderManager
import dulkirmod.utils.TabListUtils
import dulkirmod.utils.Utils
import dulkirmod.utils.WorldRenderUtils
@@ -21,21 +23,65 @@ object BlazeSlayerFeatures {
if (DulkirConfig.attunementDisplay) {
if (event.entity is EntityArmorStand && event.entity.hasCustomName()) {
val name = Utils.stripColorCodes(event.entity.customNameTag)
- val x = event.entity.lastTickPosX + (event.entity.posX - event.entity.lastTickPosX) * WorldRenderUtils.partialTicks
- val y = event.entity.lastTickPosY + (event.entity.posY - event.entity.lastTickPosY) * WorldRenderUtils.partialTicks
- val z = event.entity.lastTickPosZ + (event.entity.posZ - event.entity.lastTickPosZ) * WorldRenderUtils.partialTicks
+ val newPos = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z)
+ val x = newPos[0]
+ val y = newPos[1]
+ val z = newPos[2]
when {
name.contains("CRYSTAL ♨") -> {
- WorldRenderUtils.drawCustomBox(x -.5, 1.0, y -2, 1.5, z -.5, 1.0, Color(15, 247, 236, 255), 3f, phase = false)
+ WorldRenderUtils.drawCustomBox(
+ x - .5,
+ 1.0,
+ y - 2,
+ 1.5,
+ z - .5,
+ 1.0,
+ Color(15, 247, 236, 255),
+ 3f,
+ phase = false
+ )
}
+
name.contains("ASHEN ♨") -> {
- WorldRenderUtils.drawCustomBox(x -.5, 1.0, y -2, 1.5, z -.5, 1.0, Color(84, 84, 84, 255), 3f, phase = false)
+ WorldRenderUtils.drawCustomBox(
+ x - .5,
+ 1.0,
+ y - 2,
+ 1.5,
+ z - .5,
+ 1.0,
+ Color(0, 0, 0, 255),
+ 3f,
+ phase = false
+ )
}
+
name.contains("AURIC ♨") -> {
- WorldRenderUtils.drawCustomBox(x -.5, 1.0, y -2, 1.5, z -.5, 1.0, Color(206, 219, 57, 255), 3f, phase = false)
+ WorldRenderUtils.drawCustomBox(
+ x - .5,
+ 1.0,
+ y - 2,
+ 1.5,
+ z - .5,
+ 1.0,
+ Color(206, 219, 57, 255),
+ 3f,
+ phase = false
+ )
}
+
name.contains("SPIRIT ♨") -> {
- WorldRenderUtils.drawCustomBox(x -.5, 1.0, y -2, 1.5, z -.5, 1.0, Color(255, 255, 255, 255), 3f, phase = false)
+ WorldRenderUtils.drawCustomBox(
+ x - .5,
+ 1.0,
+ y - 2,
+ 1.5,
+ z - .5,
+ 1.0,
+ Color(255, 255, 255, 255),
+ 3f,
+ phase = false
+ )
}
}
}
@@ -44,11 +90,24 @@ object BlazeSlayerFeatures {
if (DulkirConfig.minibossHitbox) {
if (event.entity is EntityArmorStand && event.entity.hasCustomName()) {
val name = Utils.stripColorCodes(event.entity.customNameTag)
- val x = event.entity.lastTickPosX + (event.entity.posX - event.entity.lastTickPosX) * WorldRenderUtils.partialTicks
- val y = event.entity.lastTickPosY + (event.entity.posY - event.entity.lastTickPosY) * WorldRenderUtils.partialTicks
- val z = event.entity.lastTickPosZ + (event.entity.posZ - event.entity.lastTickPosZ) * WorldRenderUtils.partialTicks
+
+ val newPos = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z)
+ val x = newPos[0]
+ val y = newPos[1]
+ val z = newPos[2]
+
if (name.contains(minibosses)) {
- WorldRenderUtils.drawCustomBox(x-.5, 1.0, y - 1.5, 1.5, z-.5, 1.0, Color(7, 227, 21, 255), 3f, phase = false)
+ WorldRenderUtils.drawCustomBox(
+ x - .5,
+ 1.0,
+ y - 1.5,
+ 1.5,
+ z - .5,
+ 1.0,
+ Color(7, 227, 21, 255),
+ 3f,
+ phase = false
+ )
}
}
}
diff --git a/src/main/kotlin/dulkirmod/features/rift/IchorHighlight.kt b/src/main/kotlin/dulkirmod/features/rift/IchorHighlight.kt
index 72581d3..d18413d 100644
--- a/src/main/kotlin/dulkirmod/features/rift/IchorHighlight.kt
+++ b/src/main/kotlin/dulkirmod/features/rift/IchorHighlight.kt
@@ -19,12 +19,10 @@ object IchorHighlight {
if (TabListUtils.area != "The Rift") return
val entity = event.entity
- val x =
- entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * WorldRenderUtils.partialTicks
- val y =
- entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * WorldRenderUtils.partialTicks
- val z =
- entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * WorldRenderUtils.partialTicks
+ val newPos = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z)
+ val x = newPos[0]
+ val y = newPos[1] + 3
+ val z = newPos[2]
if (entity is EntityArmorStand) {
if (entity.getEquipmentInSlot(4) != null && entity.getEquipmentInSlot(4).item === Items.skull) {
diff --git a/src/main/kotlin/dulkirmod/features/rift/SteakDisplay.kt b/src/main/kotlin/dulkirmod/features/rift/SteakDisplay.kt
index 2489bba..877474c 100644
--- a/src/main/kotlin/dulkirmod/features/rift/SteakDisplay.kt
+++ b/src/main/kotlin/dulkirmod/features/rift/SteakDisplay.kt
@@ -19,17 +19,15 @@ object SteakDisplay {
if (event.entity is EntityArmorStand && event.entity.hasCustomName()) {
val name = Utils.stripColorCodes(event.entity.customNameTag)
- val x =
- event.entity.lastTickPosX + (event.entity.posX - event.entity.lastTickPosX) * WorldRenderUtils.partialTicks
- val y =
- event.entity.lastTickPosY + (event.entity.posY - event.entity.lastTickPosY) * WorldRenderUtils.partialTicks
- val z =
- event.entity.lastTickPosZ + (event.entity.posZ - event.entity.lastTickPosZ) * WorldRenderUtils.partialTicks
- if (name.contains(char)) {
+ val newPos = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z)
+ val x = newPos[0]
+ val y = newPos[1]
+ val z = newPos[2]
+ if (name.contains(char) && name.contains("Vampire Boss")) {
WorldRenderUtils.drawCustomBox(
x - .5,
1.0,
- y - 2,
+ y - 1.5,
1.5,
z - .5,
1.0,
diff --git a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt
index f49ed2c..229b380 100644
--- a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt
+++ b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt
@@ -1,6 +1,7 @@
package dulkirmod.utils
import dulkirmod.DulkirMod.Companion.mc
+import dulkirmod.mixins.AccessorRenderManager
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.renderer.GlStateManager.disableTexture2D
import net.minecraft.client.renderer.GlStateManager.enableTexture2D
@@ -180,5 +181,21 @@ class WorldRenderUtils {
fun grabPartialTicks(event: RenderWorldLastEvent) {
this.partialTicks = event.partialTicks
}
+
+ fun getRenderX() : Double {
+ return (mc.renderManager as AccessorRenderManager).renderX
+ }
+
+ fun getRenderY() : Double {
+ return (mc.renderManager as AccessorRenderManager).renderY
+ }
+
+ fun getRenderZ() : Double {
+ return (mc.renderManager as AccessorRenderManager).renderZ
+ }
+
+ fun fixRenderPos(x: Double, y: Double, z: Double) : Array<Double> {
+ return arrayOf(x + getRenderX(), y + getRenderY(), z + getRenderZ())
+ }
}
} \ No newline at end of file