diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java | 8 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt | 6 | ||||
-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.kt | 49 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt | 9 |
7 files changed, 70 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 9d1a21042..60254162c 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -85,6 +85,8 @@ import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerClearView import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerDaggerHelper import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerFirePitsWarning import at.hannibal2.skyhanni.features.slayer.blaze.HellionShieldHelper +import at.hannibal2.skyhanni.features.slayer.enderman.EndermanSlayerFeatures +import at.hannibal2.skyhanni.features.slayer.enderman.EndermanSlayerHideParticles import at.hannibal2.skyhanni.features.summonings.SummoningMobManager import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper @@ -225,6 +227,7 @@ class SkyHanniMod { loadModule(HellionShieldHelper()) loadModule(BlazeSlayerFirePitsWarning()) loadModule(BlazeSlayerClearView()) + loadModule(EndermanSlayerHideParticles()) loadModule(PlayerChatFilter()) loadModule(HideArmor()) loadModule(SlayerQuestWarning()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java index e3aa63c89..e5aba386f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java @@ -30,12 +30,18 @@ public class SlayerConfig { public boolean endermanHighlightNukekebi = false; @Expose - @ConfigOption(name = "Phase Display", desc = "Show the current phase of the enderman slayer.") + @ConfigOption(name = "Phase Display", desc = "Show the current phase of the enderman slayer in damage indcator.") @ConfigEditorBoolean @ConfigAccordionId(id = 0) public boolean endermanPhaseDisplay = false; @Expose + @ConfigOption(name = "Hide Particles", desc = "Hide particles around enderman slayer bosses and mini bosses.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean endermanHideParticles = false; + + @Expose @ConfigOption(name = "Blaze", desc = "") @ConfigEditorAccordion(id = 1) public boolean blaze = false; 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 +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index a8eda1617..fcdfb5cc4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth +import net.minecraft.client.Minecraft import net.minecraft.client.multiplayer.WorldClient import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase @@ -126,10 +127,10 @@ object EntityUtils { ?.value } - inline fun <reified T : Entity> WorldClient.getEntitiesNextToPlayer(radius: Double): List<T> = + inline fun <reified T : Entity> getEntitiesNextToPlayer(radius: Double): List<T> = getEntitiesNearby(LocationUtils.playerLocation(), radius) - inline fun <reified T : Entity> WorldClient.getEntitiesNearby(location: LorenzVec, radius: Double): List<T> = + inline fun <reified T : Entity> getEntitiesNearby(location: LorenzVec, radius: Double): List<T> = getLoadedEntityList().filterIsInstance<T>().filter { it.distanceTo(location) < radius } fun EntityLivingBase.isAtFullHealth() = baseMaxHealth == health.toInt() @@ -155,4 +156,8 @@ object EntityUtils { if (this is EntityPlayer) inventory.armorInventory else null fun EntityEnderman.getBlockInHand() = heldBlockState + + inline fun <reified R: Entity> getEntities(): List<R> = getLoadedEntityList().filterIsInstance<R>() + + fun getLoadedEntityList(): List<Entity> = Minecraft.getMinecraft().theWorld.getLoadedEntityList() }
\ No newline at end of file |