summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerFeatures.kt)2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt49
4 files changed, 53 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt
index befaa09f3..ca12ceea3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt
@@ -12,7 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ParticleHider {
- fun inM7Boss() = LorenzUtils.inDungeons && DungeonData.dungeonFloor == "M7" && DungeonData.inBossRoom
+ private fun inM7Boss() = LorenzUtils.inDungeons && DungeonData.dungeonFloor == "M7" && DungeonData.inBossRoom
@SubscribeEvent
fun onHypExplosions(event: ReceiveParticleEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt
index 5a23ee650..e96ae7e31 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt
@@ -7,7 +7,7 @@ import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
-import at.hannibal2.skyhanni.utils.EntityUtils.getEntitiesNearby
+import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.EntityUtils.isAtFullHealth
import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo
import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
@@ -16,7 +16,6 @@ import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import at.hannibal2.skyhanni.utils.getLorenzVec
-import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.client.event.RenderWorldLastEvent
@@ -78,8 +77,7 @@ class LivingCaveDefenseBlocks {
if (entity == null) {
// read new entity data
val compareLocation = event.location.add(-0.5, -1.5, -0.5)
- entity =
- Minecraft.getMinecraft().theWorld.getEntitiesNearby<EntityOtherPlayerMP>(compareLocation, 2.0)
+ entity = EntityUtils.getEntitiesNearby<EntityOtherPlayerMP>(compareLocation, 2.0)
.filter { isCorrectMob(it.name) }
.filter { !it.isAtFullHealth() }
.minByOrNull { it.distanceTo(compareLocation) }
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
index f55524d91..fb577cfce 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
@@ -1,4 +1,4 @@
-package at.hannibal2.skyhanni.features.slayer
+package at.hannibal2.skyhanni.features.slayer.enderman
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.IslandType
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt
new file mode 100644
index 000000000..d6ae27f3b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt
@@ -0,0 +1,49 @@
+package at.hannibal2.skyhanni.features.slayer.enderman
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.events.ReceiveParticleEvent
+import at.hannibal2.skyhanni.utils.EntityUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
+import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.getLorenzVec
+import net.minecraft.entity.monster.EntityEnderman
+import net.minecraft.util.EnumParticleTypes
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class EndermanSlayerHideParticles {
+
+ private var endermanLocations = listOf<LorenzVec>()
+
+ @SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ if (!isEnabled()) return
+
+ endermanLocations = EntityUtils.getEntities<EntityEnderman>().map { it.getLorenzVec() }
+ }
+
+ @SubscribeEvent
+ fun onReceivePacket(event: ReceiveParticleEvent) {
+ if (!isEnabled()) return
+
+ when (event.type) {
+ EnumParticleTypes.SMOKE_LARGE,
+ EnumParticleTypes.FLAME,
+ EnumParticleTypes.SPELL_WITCH,
+ -> {
+ }
+
+ else -> return
+ }
+
+ val distance = event.location.distanceToNearestEnderman() ?: return
+ if (distance < 9) {
+ event.isCanceled = true
+ }
+ }
+
+ private fun LorenzVec.distanceToNearestEnderman() = endermanLocations.minOfOrNull { it.distanceSq(this) }
+
+ fun isEnabled() = IslandType.THE_END.isInIsland() && SkyHanniMod.feature.slayer.endermanHideParticles
+}