aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-08 10:37:43 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-08 10:37:43 +0100
commit0e2e5e9457a051807362665e6dcfc7a75faa5d64 (patch)
tree3a6f34d9360f6612c36e26887ac6399a16aaea53 /src/main/java/at/hannibal2/skyhanni/features/misc
parentc950ead540848412489e74dd4f2d0f6b9c74147e (diff)
downloadskyhanni-0e2e5e9457a051807362665e6dcfc7a75faa5d64.tar.gz
skyhanni-0e2e5e9457a051807362665e6dcfc7a75faa5d64.tar.bz2
skyhanni-0e2e5e9457a051807362665e6dcfc7a75faa5d64.zip
Added more visibility changes around blaze slayer.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/HideDeadEntities.kt36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideDeadEntities.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideDeadEntities.kt
new file mode 100644
index 000000000..e4a29513f
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideDeadEntities.kt
@@ -0,0 +1,36 @@
+package at.hannibal2.skyhanni.features.misc
+
+import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
+import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class HideDeadEntities {
+ private val hiddenEntities = mutableListOf<Int>()
+
+ @SubscribeEvent
+ fun onEntityHealthUpdate(event: EntityHealthUpdateEvent) {
+ val entityId = event.entity.entityId
+
+ if (event.health <= 0) {
+ if (!hiddenEntities.contains(entityId)) {
+ hiddenEntities.add(entityId)
+// LorenzUtils.chat("died: ${event.entity.name}")
+ }
+ } else {
+ if (hiddenEntities.contains(entityId)) {
+ hiddenEntities.remove(entityId)
+ LorenzUtils.debug("respawned: ${event.entity.name}")
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onCheckRender(event: CheckRenderEntityEvent<*>) {
+ if (!LorenzUtils.inSkyBlock) return
+
+ if (hiddenEntities.contains(event.entity.entityId)) {
+ event.isCanceled = true
+ }
+ }
+} \ No newline at end of file