aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-05-27 09:35:28 -0500
committeringlettronald <inglettronald@gmail.com>2023-05-27 09:35:28 -0500
commit3522547b73cfaeacd943781b3b26323eea27b989 (patch)
treed10da0810509e9b1c6623304875cdf63eb53a134 /src/main/kotlin/dulkirmod/features
parentdf1a6e8bfa78d55e0b5e3123d0e6e6049bba713f (diff)
downloadDulkirMod-3522547b73cfaeacd943781b3b26323eea27b989.tar.gz
DulkirMod-3522547b73cfaeacd943781b3b26323eea27b989.tar.bz2
DulkirMod-3522547b73cfaeacd943781b3b26323eea27b989.zip
some random stuff
Diffstat (limited to 'src/main/kotlin/dulkirmod/features')
-rw-r--r--src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt31
-rw-r--r--src/main/kotlin/dulkirmod/features/StarredMobBoxes.kt69
2 files changed, 98 insertions, 2 deletions
diff --git a/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt b/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt
index d0976b9..5edde33 100644
--- a/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt
+++ b/src/main/kotlin/dulkirmod/features/MemoryLeakFix.kt
@@ -2,10 +2,13 @@ package dulkirmod.features
import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.DulkirConfig
+import dulkirmod.utils.WorldRenderUtils
import net.minecraft.entity.Entity
import net.minecraft.entity.item.EntityArmorStand
+import net.minecraftforge.client.event.RenderLivingEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
+import java.awt.Color
object MemoryLeakFix {
private var lastClear = System.currentTimeMillis()
@@ -39,10 +42,34 @@ object MemoryLeakFix {
val currentEnts = world.loadedEntityList
currentEnts.forEach {
if (it !is EntityArmorStand) return@forEach
- if (it.name != "Armor Stand") return@forEach
+ if (it.hasCustomName()) return@forEach
if (it.inventory.any{slot -> slot != null}) return@forEach
- if (it.motionX != 0.toDouble() || it.motionY != 0.toDouble() || it.motionZ != 0.toDouble()) return@forEach
+ if (it.ticksExisted < 1200) return@forEach
world.removeEntityFromWorld(it.entityId)
}
}
+
+ @SubscribeEvent
+ fun displayBlankStands(event: RenderLivingEvent.Post<*>) {
+ if (!DulkirConfig.debugStandRemoval) return
+ if (event.entity !is EntityArmorStand) return
+ if (event.entity.hasCustomName()) return
+ if (event.entity.inventory.any{slot -> slot != null}) return
+ val pos = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z)
+ val x = pos[0]
+ val y = pos[1]
+ val z = pos[2]
+
+ WorldRenderUtils.drawCustomBox(
+ x - .5,
+ 1.0,
+ y - .5,
+ 1.0,
+ z - .5,
+ 1.0,
+ Color(15, 247, 236, 255),
+ 3f,
+ phase = true
+ )
+ }
} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/features/StarredMobBoxes.kt b/src/main/kotlin/dulkirmod/features/StarredMobBoxes.kt
new file mode 100644
index 0000000..a9aa932
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/features/StarredMobBoxes.kt
@@ -0,0 +1,69 @@
+package dulkirmod.features
+
+import dulkirmod.config.DulkirConfig
+import dulkirmod.utils.TabListUtils
+import dulkirmod.utils.WorldRenderUtils
+import net.minecraftforge.client.event.RenderLivingEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.awt.Color
+
+object StarredMobBoxes {
+ @SubscribeEvent
+ fun render(event: RenderLivingEvent.Post<*>) {
+ if (!DulkirConfig.starredBoxes) return
+ if (TabListUtils.area != "Dungeon") return
+ val name = event.entity.name ?: return
+ if (name.startsWith("§6✯ ") && name.endsWith("§c❤")) {
+ val newPos = WorldRenderUtils.fixRenderPos(event.x, event.y, event.z)
+ val x = newPos[0]
+ val y = newPos[1]
+ val z = newPos[2]
+
+ if ("Spider" in name) {
+// x - 0.625,
+// y - 1,
+// z - 0.625,
+// x + 0.625,
+// y - 0.25,
+// z + 0.625
+ WorldRenderUtils.drawCustomBox(
+ x - .625,
+ 1.25,
+ y - 1,
+ .75,
+ z - .625,
+ 1.25,
+ Color(15, 247, 236, 255),
+ 3f,
+ phase = false
+ )
+ } else if ("Fels" in name || "Withermancer" in name) {
+ //AxisAlignedBB(x - 0.5, y - 3, z - 0.5, x + 0.5, y, z + 0.5),
+ WorldRenderUtils.drawCustomBox(
+ x - .5,
+ 1.0,
+ y - 3,
+ 3.0,
+ z - .5,
+ 1.0,
+ Color(15, 247, 236, 255),
+ 3f,
+ phase = false
+ )
+ } else {
+ //AxisAlignedBB(x - 0.5, y - 2, z - 0.5, x + 0.5, y, z + 0.5),
+ WorldRenderUtils.drawCustomBox(
+ x - .5,
+ 1.0,
+ y - 2,
+ 2.0,
+ z - .5,
+ 1.0,
+ Color(15, 247, 236, 255),
+ 3f,
+ phase = false
+ )
+ }
+ }
+ }
+} \ No newline at end of file