diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-23 14:21:51 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-23 14:21:51 +0200 |
commit | 22cb7698523cd83d827efc3e879e180ac959c305 (patch) | |
tree | 5d4e9649af9d827343a906cab6a6ae41525b7027 /src/main/java/at/hannibal2/skyhanni/features/minion | |
parent | f5678d1bb7d9e27817528fc2e81bdb2386dcc31e (diff) | |
download | skyhanni-22cb7698523cd83d827efc3e879e180ac959c305.tar.gz skyhanni-22cb7698523cd83d827efc3e879e180ac959c305.tar.bz2 skyhanni-22cb7698523cd83d827efc3e879e180ac959c305.zip |
added option to hide mob nametags close to minions
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/minion')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/minion/MinionHelper.kt) | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 039dd06df..f88f23772 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -8,15 +8,19 @@ import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex import at.hannibal2.skyhanni.utils.RenderUtils.drawString import net.minecraft.client.Minecraft +import net.minecraft.entity.EntityLivingBase +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.InputEvent import net.minecraftforge.fml.common.gameevent.TickEvent import org.lwjgl.input.Mouse import java.awt.Color -class MinionHelper { +class MinionFeatures { var lastClickedEntity: LorenzVec? = null var lastMinion: LorenzVec? = null @@ -40,17 +44,13 @@ class MinionHelper { if (!LorenzUtils.inSkyblock) return if (LorenzUtils.skyBlockIsland != "Private Island") return + if (!Mouse.getEventButtonState()) return + if (Mouse.getEventButton() != 1) return + val minecraft = Minecraft.getMinecraft() - val buttonState = Mouse.getEventButtonState() - val eventButton = Mouse.getEventButton() - - if (buttonState) { - if (eventButton == 1) { - val entity = minecraft.pointedEntity - if (entity != null) { - lastClickedEntity = entity.getLorenzVec() - } - } + val entity = minecraft.pointedEntity + if (entity != null) { + lastClickedEntity = entity.getLorenzVec() } } @@ -155,4 +155,26 @@ class MinionHelper { } } } -}
\ No newline at end of file + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) { + if (!LorenzUtils.inSkyblock) return + if (LorenzUtils.skyBlockIsland != "Private Island") return + if (!SkyHanniMod.feature.minions.hideMobsNametagNearby) return + + val entity = event.entity + if (entity !is EntityArmorStand) return +// if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return + if (!entity.hasCustomName()) return + if (entity.isDead) return + + if (entity.customNameTag.contains("§c❤")) { + var loc = entity.getLorenzVec() + if (minions.any { it.key.distance(loc) < 5 }) { + event.isCanceled = true + } + } + } +} + +//
\ No newline at end of file |