aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt31
-rw-r--r--src/main/kotlin/dulkirmod/features/ListClear.kt34
2 files changed, 47 insertions, 18 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index dcf5718..0ded276 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -62,19 +62,20 @@ class DulkirMod {
// REGISTER Classes and such HERE
val mcBus = MinecraftForge.EVENT_BUS
mcBus.register(this)
- mcBus.register(ChatEvent())
+ mcBus.register(ListClear)
+ mcBus.register(ChatEvent)
mcBus.register(NametagCleaner)
- mcBus.register(titleUtils)
- mcBus.register(ArachneTimer())
- mcBus.register(MatchoAlert())
- mcBus.register(Croesus())
- mcBus.register(ContainerNameUtil())
- mcBus.register(DungeonLeap())
- mcBus.register(AbiphoneDND())
- mcBus.register(KeeperWaypoints())
+ mcBus.register(TitleUtils)
+ mcBus.register(ArachneTimer)
+ mcBus.register(MatchoAlert)
+ mcBus.register(Croesus)
+ mcBus.register(ContainerNameUtil)
+ mcBus.register(DungeonLeap)
+ mcBus.register(AbiphoneDND)
+ mcBus.register(KeeperWaypoints)
mcBus.register(ScalableTooltips)
- mcBus.register(GardenVisitorAlert())
- mcBus.register(DragonTimer())
+ mcBus.register(GardenVisitorAlert)
+ mcBus.register(DragonTimer)
keyBinds.forEach(ClientRegistry::registerKeyBinding)
}
@@ -98,8 +99,7 @@ class DulkirMod {
if (currTime - lastLongUpdate > 1000) { // long update
alarmClock()
brokenHypeNotif()
- matchoAlert.alert()
- gardenVisitorAlert.alert()
+ GardenVisitorAlert.alert()
// Now I don't have to fetch the entries for multiple things, this just updates and caches
// the data structure on 1s cooldown
TabListUtils.parseTabEntries()
@@ -130,11 +130,6 @@ class DulkirMod {
var config = Config
var display: GuiScreen? = null
val scope = CoroutineScope(EmptyCoroutineContext)
- val titleUtils = TitleUtils()
- val matchoAlert = MatchoAlert()
- val gardenVisitorAlert = GardenVisitorAlert()
- val DragonTimer = DragonTimer()
- var tabEntries: List<String?> = emptyList()
val keyBinds = arrayOf(
KeyBinding("Open Settings", Keyboard.KEY_RSHIFT, "Dulkir Mod"),
diff --git a/src/main/kotlin/dulkirmod/features/ListClear.kt b/src/main/kotlin/dulkirmod/features/ListClear.kt
new file mode 100644
index 0000000..2a574d2
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/features/ListClear.kt
@@ -0,0 +1,34 @@
+package dulkirmod.features
+
+import dulkirmod.DulkirMod.Companion.mc
+import dulkirmod.config.Config
+import net.minecraft.entity.Entity
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+object ListClear {
+ var lastClear = System.currentTimeMillis()
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (!Config.crimsonIslesMemoryLeakPatch)
+
+ if (System.currentTimeMillis() - lastClear >= 30000L) {
+ val world = mc.theWorld ?: return
+ val currentEnts = world.playerEntities.toMutableList()
+ currentEnts.forEach {
+ if (it.isDead) {
+ world.playerEntities.remove(it)
+ }
+ if (isNullVec(it)) {
+ world.removeEntityFromWorld(it.entityId)
+ }
+ }
+ lastClear = System.currentTimeMillis()
+ }
+ }
+
+ private fun isNullVec(entity: Entity): Boolean {
+ return entity.posX == 0.0 && entity.posY == 0.0 && entity.posZ == 0.0
+ }
+} \ No newline at end of file