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 | |
| 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')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt | 10 | ||||
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt) | 2 | ||||
| -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 |
3 files changed, 40 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index 78e8ca648..8f397de02 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -33,20 +33,20 @@ import kotlin.math.max class DamageIndicatorManager { var data = mutableMapOf<UUID, EntityData>() - private var bossFinder: BossFinder? = null + private var mobFinder: MobFinder? = null private val decimalFormat = DecimalFormat("0.0") private val maxHealth = mutableMapOf<UUID, Int>() private val damagePattern = Pattern.compile("✧?(\\d+[⚔+✧❤♞☄✷ﬗ]*)") @SubscribeEvent fun onWorldLoad(event: WorldEvent.Load) { - bossFinder = BossFinder() + mobFinder = MobFinder() data.clear() } @SubscribeEvent(receiveCanceled = true) fun onChatMessage(event: LorenzChatEvent) { - bossFinder?.handleChat(event.message) + mobFinder?.handleChat(event.message) } @SubscribeEvent @@ -516,7 +516,7 @@ class DamageIndicatorManager { private fun grabData(entity: EntityLivingBase): EntityData? { if (data.contains(entity.uniqueID)) return data[entity.uniqueID] - val entityResult = bossFinder?.tryAdd(entity) ?: return null + val entityResult = mobFinder?.tryAdd(entity) ?: return null return EntityData( entity, entityResult.ignoreBlocks, @@ -542,7 +542,7 @@ class DamageIndicatorManager { @SubscribeEvent fun onEntityJoin(event: EntityJoinWorldEvent) { - bossFinder?.handleNewEntity(event.entity) + mobFinder?.handleNewEntity(event.entity) } private val dummyDamageCache = mutableListOf<UUID>() diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt index 2f151abf4..636fff106 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt @@ -19,7 +19,7 @@ import net.minecraft.entity.passive.EntityHorse import net.minecraft.entity.passive.EntityWolf import java.util.* -class BossFinder { +class MobFinder { //F1 private var floor1bonzo1 = false 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 |
