diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-02-08 10:37:43 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-02-08 10:37:43 +0100 |
commit | 0e2e5e9457a051807362665e6dcfc7a75faa5d64 (patch) | |
tree | 3a6f34d9360f6612c36e26887ac6399a16aaea53 /src | |
parent | c950ead540848412489e74dd4f2d0f6b9c74147e (diff) | |
download | skyhanni-0e2e5e9457a051807362665e6dcfc7a75faa5d64.tar.gz skyhanni-0e2e5e9457a051807362665e6dcfc7a75faa5d64.tar.bz2 skyhanni-0e2e5e9457a051807362665e6dcfc7a75faa5d64.zip |
Added more visibility changes around blaze slayer.
Diffstat (limited to 'src')
9 files changed, 98 insertions, 23 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index e4b190fe2..1b93a00ad 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -37,7 +37,10 @@ import at.hannibal2.skyhanni.features.slayer.EndermanSlayerBeacon; import at.hannibal2.skyhanni.features.slayer.HideMobNames; import at.hannibal2.skyhanni.features.slayer.HighlightSlayerMiniBoss; import at.hannibal2.skyhanni.features.slayer.SlayerQuestWarning; -import at.hannibal2.skyhanni.features.slayer.blaze.*; +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.summonings.SummoningMobManager; import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName; import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper; @@ -185,6 +188,7 @@ public class SkyHanniMod { loadModule(new BingoCardDisplay()); loadModule(new BingoNextStepHelper()); loadModule(new MinionCraftHelper()); + loadModule(new HideDeadEntities()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 1e7d9f07c..ea51e129e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -172,11 +172,21 @@ public class Misc { public boolean hideExpBottles = false; @Expose - @ConfigOption(name = "Blaze Particles", desc = "Hide Blaze Particles") + @ConfigOption(name = "Blaze Particles", desc = "Hide blaze particles") @ConfigEditorBoolean public boolean hideBlazeParticles = false; @Expose + @ConfigOption(name = "Fireball Particles", desc = "Hide fireball particles") + @ConfigEditorBoolean + public boolean hideFireballParticles = false; + + @Expose + @ConfigOption(name = "Fire Particles", desc = "Hide particles from the fire block.") + @ConfigEditorBoolean + public boolean hideFireBlockParticles = false; + + @Expose @ConfigOption(name = "Collection Counter Position", desc = "Tracking the number of items you collect. §cDoes not work with sacks.") @ConfigEditorButton(runnableId = "collectionCounter", buttonText = "Edit") public Position collectionCounterPos = new Position(10, 10, false, true); 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 diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt index 43c17ec5a..9c220bea9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt @@ -34,7 +34,7 @@ class BlazeSlayerClearView { BossType.SLAYER_BLAZE_QUAZII_2, BossType.SLAYER_BLAZE_QUAZII_3, BossType.SLAYER_BLAZE_QUAZII_4, - ) < 10 + ) < 20 } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinBlockFire.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinBlockFire.java new file mode 100644 index 000000000..0d043ad0d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinBlockFire.java @@ -0,0 +1,20 @@ +package at.hannibal2.skyhanni.mixins.transformers; + +import at.hannibal2.skyhanni.SkyHanniMod; +import net.minecraft.block.BlockFire; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(BlockFire.class) +public class MixinBlockFire { + + @Redirect(method = "randomDisplayTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnParticle(Lnet/minecraft/util/EnumParticleTypes;DDDDDD[I)V")) + private void onLivingUpdate(World world, EnumParticleTypes particleType, double x, double y, double z, double xOffset, double yOffset, double zOffset, int[] p_175688_14_) { + if (!SkyHanniMod.feature.misc.hideFireBlockParticles) { + world.spawnParticle(particleType, x, y, z, xOffset, yOffset, zOffset, p_175688_14_); + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java index d041a8b69..60dd87e83 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java @@ -12,9 +12,9 @@ import org.spongepowered.asm.mixin.injection.Redirect; public class MixinEntityBlaze { @Redirect(method = "onLivingUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnParticle(Lnet/minecraft/util/EnumParticleTypes;DDDDDD[I)V")) - private void onLivingUpdate(World instance, EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int[] p_175688_14_) { + private void onLivingUpdate(World world, EnumParticleTypes particleType, double x, double y, double z, double xOffset, double yOffset, double zOffset, int[] p_175688_14_) { if (!SkyHanniMod.feature.misc.hideBlazeParticles) { - instance.spawnParticle(particleType, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, p_175688_14_); + world.spawnParticle(particleType, x, y, z, xOffset, yOffset, zOffset, p_175688_14_); } } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityFireball.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityFireball.java new file mode 100644 index 000000000..1783cd791 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityFireball.java @@ -0,0 +1,20 @@ +package at.hannibal2.skyhanni.mixins.transformers; + +import at.hannibal2.skyhanni.SkyHanniMod; +import net.minecraft.entity.projectile.EntityFireball; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(EntityFireball.class) +public class MixinEntityFireball { + + @Redirect(method = "onUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnParticle(Lnet/minecraft/util/EnumParticleTypes;DDDDDD[I)V")) + private void onLivingUpdate(World world, EnumParticleTypes particleType, double x, double y, double z, double xOffset, double yOffset, double zOffset, int[] p_175688_14_) { + if (!SkyHanniMod.feature.misc.hideFireballParticles) { + world.spawnParticle(particleType, x, y, z, xOffset, yOffset, zOffset, p_175688_14_); + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java index 1085f6c7f..d85da40df 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java @@ -9,28 +9,11 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.util.HashMap; -import java.util.UUID; - @Mixin(RenderManager.class) public class MixinRenderManager { - private final HashMap<UUID, Long> lastColorCacheTime = new HashMap<>(); - private final HashMap<UUID, Boolean> cache = new HashMap<>(); - @Inject(method = "shouldRender", at = @At("HEAD"), cancellable = true) private void shouldRender(Entity entity, ICamera camera, double camX, double camY, double camZ, CallbackInfoReturnable<Boolean> cir) { - UUID uuid = entity.getUniqueID(); - boolean shouldRender; - if (lastColorCacheTime.getOrDefault(uuid, 0L) + 1_000 > System.currentTimeMillis()) { - shouldRender = cache.get(uuid); - } else { - shouldRender = !new CheckRenderEntityEvent<>(entity, camera, camX, camY, camZ).postAndCatch(); - - cache.put(uuid, shouldRender); - lastColorCacheTime.put(uuid, System.currentTimeMillis()); - } - - cir.setReturnValue(shouldRender); + cir.setReturnValue(!new CheckRenderEntityEvent<>(entity, camera, camX, camY, camZ).postAndCatch()); } } diff --git a/src/main/resources/mixins.skyhanni.json b/src/main/resources/mixins.skyhanni.json index 7fe2496a2..b501d3dc1 100644 --- a/src/main/resources/mixins.skyhanni.json +++ b/src/main/resources/mixins.skyhanni.json @@ -4,7 +4,9 @@ "compatibilityLevel": "JAVA_8", "mixins": [ "AccessorGuiPlayerTabOverlay", + "MixinBlockFire", "MixinEntityBlaze", + "MixinEntityFireball", "MixinNetHandlerPlayClient", "MixinNetworkManager", "MixinRenderItem", |