From 7174c5eadbad4881c19f1ed5610285dc934741a1 Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Sat, 1 Jun 2024 11:23:19 +0200 Subject: Feature: Hide Useless Armorstands (#1962) --- .../hannibal2/skyhanni/config/features/misc/MiscConfig.java | 6 ++++++ .../at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt | 12 ++++++++++++ 2 files changed, 18 insertions(+) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java index 1921d64b3..c390e7feb 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java @@ -118,6 +118,12 @@ public class MiscConfig { @FeatureToggle public boolean hideExpBottles = false; + @Expose + @ConfigOption(name = "Armorstands", desc = "Hides Armorstands that are sometimes visible for a fraction of a second.") + @ConfigEditorBoolean + @FeatureToggle + public boolean hideTemporaryArmorstands = true; + @Expose public Position collectionCounterPos = new Position(10, 10, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt index 06720e8ea..d5246fc12 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt @@ -1,9 +1,12 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.MobUtils.isDefaultValue +import net.minecraft.entity.item.EntityArmorStand import net.minecraft.network.play.server.S0CPacketSpawnPlayer import net.minecraft.network.play.server.S0FPacketSpawnMob import net.minecraft.network.play.server.S13PacketDestroyEntities @@ -55,5 +58,14 @@ object FixGhostEntities { } } + @SubscribeEvent + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (!LorenzUtils.inSkyBlock || !config.hideTemporaryArmorstands) return + if (event.entity !is EntityArmorStand) return + with(event.entity) { + if (ticksExisted < 10 && isDefaultValue() && inventory.all { it == null }) event.cancel() + } + } + fun isEnabled() = LorenzUtils.inSkyBlock && config.fixGhostEntities } -- cgit