aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-23 14:21:51 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-23 14:21:51 +0200
commit22cb7698523cd83d827efc3e879e180ac959c305 (patch)
tree5d4e9649af9d827343a906cab6a6ae41525b7027 /src/main/java/at/hannibal2
parentf5678d1bb7d9e27817528fc2e81bdb2386dcc31e (diff)
downloadskyhanni-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')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Minions.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Misc.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt10
-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
6 files changed, 49 insertions, 21 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 0bccba373..a12348214 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -26,7 +26,7 @@ import at.hannibal2.skyhanni.features.items.HideNotClickableItems;
import at.hannibal2.skyhanni.features.items.ItemDisplayOverlayFeatures;
import at.hannibal2.skyhanni.features.items.ItemStars;
import at.hannibal2.skyhanni.features.items.abilitycooldown.ItemAbilityCooldown;
-import at.hannibal2.skyhanni.features.minion.MinionHelper;
+import at.hannibal2.skyhanni.features.minion.MinionFeatures;
import at.hannibal2.skyhanni.features.nether.ashfang.AshfangFreezeCooldown;
import at.hannibal2.skyhanni.features.nether.ashfang.AshfangGravityOrbs;
import at.hannibal2.skyhanni.features.nether.ashfang.AshfangNextResetCooldown;
@@ -89,7 +89,7 @@ public class SkyHanniMod {
registerEvent(new SummoningSoulsName());
registerEvent(new AshfangGravityOrbs());
registerEvent(new ItemStars());
- registerEvent(new MinionHelper());
+ registerEvent(new MinionFeatures());
registerEvent(new RealTime());
Commands.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Minions.java b/src/main/java/at/hannibal2/skyhanni/config/features/Minions.java
index f59008917..016d5f6d2 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Minions.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Minions.java
@@ -59,4 +59,9 @@ public class Minions {
)
@ConfigAccordionId(id = 1)
public int emptiedTimeDistance = 10;
+
+ @Expose
+ @ConfigOption(name = "Hide Mob Nametag", desc = "Hiding the nametag of mobs close to minions")
+ @ConfigEditorBoolean
+ public boolean hideMobsNametagNearby = false;
}
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 f04d6db26..64b5e0630 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
@@ -24,7 +24,8 @@ public class Misc {
public boolean hideExpBottles = false;
@Expose
- @ConfigOption(name = "Summon Soul Display", desc = "Shows the name above summoning souls that ready to pick up. §cNot working in Dungeon if Skytils' 'Hide Non-Starred Mobs Nametags' feature is enabled!")
+ @ConfigOption(name = "Summon Soul Display", desc = "Shows the name above summoning souls that ready to pick up. " +
+ "§cNot working in Dungeon if Skytils' 'Hide Non-Starred Mobs Nametags' feature is enabled!")
@ConfigEditorBoolean
public boolean summonSoulDisplay = false;
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