aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Features.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java (renamed from src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java)10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerFeatures.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt)99
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt3
5 files changed, 48 insertions, 68 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 962d0474e..f538d1ed9 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -213,7 +213,7 @@ class SkyHanniMod {
loadModule(HighlightDungeonDeathmite())
loadModule(DungeonHideItems())
loadModule(DungeonCopilot())
- loadModule(EndermanSlayerBeacon())
+ loadModule(EndermanSlayerFeatures())
loadModule(FireVeilWandParticles())
loadModule(HideMobNames())
loadModule(HideDamageSplash())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java
index a680c806d..88a60c8ef 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Features.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java
@@ -89,7 +89,7 @@ public class Features extends Config {
@Expose
@Category(name = "Slayer", desc = "Slayer features.")
- public Slayer slayer = new Slayer();
+ public SlayerConfig slayer = new SlayerConfig();
@Expose
@Category(name = "Diana", desc = "Diana's mythological event.")
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java b/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java
index 55b6059c9..e3aa63c89 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java
@@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.*;
-public class Slayer {
+public class SlayerConfig {
@Expose
@ConfigOption(name = "Enderman Slayer Features", desc = "")
@@ -12,22 +12,22 @@ public class Slayer {
public boolean enderman = false;
@Expose
- @ConfigOption(name = "Enderman Beacon", desc = "Highlight the enderman slayer Yang Glyph (Beacon) in red color. Supports beacon in hand and beacon flying.")
+ @ConfigOption(name = "Highlight Yang Glyph", desc = "Highlight the enderman slayer Yang Glyph (beacon) in red color. Supports beacon in hand and beacon flying.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
public boolean slayerEndermanBeacon = false;
@Expose
- @ConfigOption(name = "Enderman Beacon Warnig", desc = "Displays a warning mid-screen then the enderman Slayer throws a Yang Glyph (beacon).")
+ @ConfigOption(name = "Beacon Warning", desc = "Displays a warning mid-screen then the enderman Slayer throws a Yang Glyph (beacon).")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
public boolean slayerEndermanBeaconWaring = false;
@Expose
- @ConfigOption(name = "Enderman Highlight Nukekebi Skulls", desc = "Highlights the enderman Slayer Nukekebi Skulls.")
+ @ConfigOption(name = "Highlight Nukekebi Skulls", desc = "Highlights the enderman Slayer Nukekebi Skulls.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
- public boolean slayerEndermanHighlightNukekebiSkulls = false;
+ public boolean endermanHighlightNukekebi = false;
@Expose
@ConfigOption(name = "Phase Display", desc = "Show the current phase of the enderman slayer.")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerFeatures.kt
index 7683b30d1..f55524d91 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerFeatures.kt
@@ -7,88 +7,89 @@ import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.RenderMobColoredEvent
import at.hannibal2.skyhanni.events.ServerBlockChangeEvent
import at.hannibal2.skyhanni.events.withAlpha
-import at.hannibal2.skyhanni.features.damageindicator.BossType
-import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.*
+import at.hannibal2.skyhanni.utils.EntityUtils.getBlockInHand
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.monster.EntityEnderman
import net.minecraft.init.Blocks
-import net.minecraft.init.Items
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
-class EndermanSlayerBeacon {
-
+class EndermanSlayerFeatures {
+ private val config get() = SkyHanniMod.feature.slayer
private val endermenWithBeacons = mutableListOf<EntityEnderman>()
private val flyingBeacons = mutableListOf<EntityArmorStand>()
private val nukekebiSkulls = mutableListOf<EntityArmorStand>()
private val sittingBeacon = mutableListOf<LorenzVec>()
- private val logger = LorenzLogger("slayer/voildgloom_beacon")
+ private val logger = LorenzLogger("slayer/enderman")
+ private val nukekebiSkulTexture =
+ "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="
@SubscribeEvent
fun onCheckRender(event: CheckRenderEntityEvent<*>) {
+ if (!IslandType.THE_END.isInIsland()) return
val entity = event.entity
if (entity in endermenWithBeacons || entity in flyingBeacons) return
if (entity is EntityEnderman) {
- if (hasBeaconInHand(entity) && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) {
- endermenWithBeacons.add(entity)
- logger.log("Added enderman with beacon at ${entity.getLorenzVec()}")
+ if (config.slayerEndermanBeacon) {
+ if (hasBeaconInHand(entity) && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) {
+ endermenWithBeacons.add(entity)
+ logger.log("Added enderman with beacon at ${entity.getLorenzVec()}")
+ }
}
}
if (entity is EntityArmorStand) {
- val stack = entity.inventory[4] ?: return
- if (stack.name == "Beacon" && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) {
- flyingBeacons.add(entity)
- if(isBeaconWarningEnabled())
- TitleUtils.sendTitle("§4Beacon", 1_000)
- logger.log("Added flying beacons at ${entity.getLorenzVec()}")
+ if (config.slayerEndermanBeacon) {
+ val stack = entity.inventory[4] ?: return
+ if (stack.name == "Beacon" && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) {
+ flyingBeacons.add(entity)
+ if (config.slayerEndermanBeaconWaring)
+ TitleUtils.sendTitle("§4Beacon", 2_00)
+ logger.log("Added flying beacons at ${entity.getLorenzVec()}")
+ }
}
- if (entity.inventory.any {
- it?.takeIf { it.item == Items.skull }
- ?.let { it.getSkullTexture() } == "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="
- }) {
- nukekebiSkulls.add(entity)
- logger.log("Added nukekebi skulls at ${entity.getLorenzVec()}")
- nukekebiSkulls.also { it.removeAll { it.isDead } }
-
+ if (config.endermanHighlightNukekebi) {
+ if (entity.inventory.any { it?.getSkullTexture() == nukekebiSkulTexture }) {
+ nukekebiSkulls.add(entity)
+ logger.log("Added nukekebi skulls at ${entity.getLorenzVec()}")
+ nukekebiSkulls.also { it.removeAll { it.isDead } }
+ }
}
}
}
- private fun hasBeaconInHand(entity: EntityEnderman): Boolean {
- val heldBlockState = entity.heldBlockState ?: return false
- val block = heldBlockState.block ?: return false
- return block == Blocks.beacon
- }
+ private fun hasBeaconInHand(enderman: EntityEnderman) = enderman.getBlockInHand()?.block == Blocks.beacon
- private fun canSee(a: LorenzVec, b: LorenzVec): Boolean = LocationUtils.canSee(a, b) || a.distance(b) < 15
+ private fun canSee(a: LorenzVec, b: LorenzVec) = LocationUtils.canSee(a, b) || a.distance(b) < 15
@SubscribeEvent
fun onRenderMobColored(event: RenderMobColoredEvent) {
- if(!isBeaconEnabled() && !isHighlightNukekebiSkullsEnabled()) return
+ if (!IslandType.THE_END.isInIsland()) return
- if (isBeaconEnabled() && event.entity in flyingBeacons) {
+ if (config.slayerEndermanBeacon && event.entity in flyingBeacons) {
event.color = LorenzColor.DARK_RED.toColor().withAlpha(1)
}
- if (isHighlightNukekebiSkullsEnabled() && event.entity in nukekebiSkulls) {
- event.color = LorenzColor.DARK_RED.toColor().withAlpha(1)
+ if (config.endermanHighlightNukekebi && event.entity in nukekebiSkulls) {
+ event.color = LorenzColor.GOLD.toColor().withAlpha(1)
}
}
@SubscribeEvent(priority = EventPriority.HIGH)
fun onWorldRender(event: RenderWorldLastEvent) {
- if (!isBeaconEnabled()) return
+ if (!IslandType.THE_END.isInIsland()) return
+ if (!config.slayerEndermanBeacon) return
endermenWithBeacons.removeIf { it.isDead || !hasBeaconInHand(it) }
@@ -97,16 +98,16 @@ class EndermanSlayerBeacon {
for (location in sittingBeacon.toMutableList()) {
event.drawColor(location, LorenzColor.DARK_RED, alpha = 1f)
- event.drawWaypointFilled(location, LorenzColor.RED.toColor(),true,true)
+ event.drawWaypointFilled(location, LorenzColor.RED.toColor(), true, true)
event.drawString(location.add(0.5, 0.5, 0.5), "§4Beacon", true)
-
}
}
@SubscribeEvent
fun onBlockChange(event: ServerBlockChangeEvent) {
- if (!isBeaconEnabled()) return
+ if (!IslandType.THE_END.isInIsland()) return
+ if (!config.slayerEndermanBeacon) return
val location = event.location
if (event.new == "beacon") {
@@ -124,30 +125,6 @@ class EndermanSlayerBeacon {
}
}
- private fun isBeaconEnabled(): Boolean = LorenzUtils.inSkyBlock &&
- SkyHanniMod.feature.slayer.slayerEndermanBeacon &&
- LorenzUtils.skyBlockIsland == IslandType.THE_END &&
- DamageIndicatorManager.isBossSpawned(
- BossType.SLAYER_ENDERMAN_2,
- BossType.SLAYER_ENDERMAN_3,
- BossType.SLAYER_ENDERMAN_4
- )
- private fun isBeaconWarningEnabled(): Boolean = LorenzUtils.inSkyBlock &&
- SkyHanniMod.feature.slayer.slayerEndermanBeaconWaring &&
- LorenzUtils.skyBlockIsland == IslandType.THE_END &&
- DamageIndicatorManager.isBossSpawned(
- BossType.SLAYER_ENDERMAN_2,
- BossType.SLAYER_ENDERMAN_3,
- BossType.SLAYER_ENDERMAN_4
- )
- private fun isHighlightNukekebiSkullsEnabled(): Boolean = LorenzUtils.inSkyBlock &&
- SkyHanniMod.feature.slayer.slayerEndermanHighlightNukekebiSkulls &&
- LorenzUtils.skyBlockIsland == IslandType.THE_END &&
- DamageIndicatorManager.isBossSpawned(
- BossType.SLAYER_ENDERMAN_3,
- BossType.SLAYER_ENDERMAN_4
- )
-
@SubscribeEvent
fun onWorldChange(event: WorldEvent.Load) {
endermenWithBeacons.clear()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
index b9a4c4bcb..a8eda1617 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
@@ -8,6 +8,7 @@ import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.monster.EntityBlaze
+import net.minecraft.entity.monster.EntityEnderman
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
import net.minecraft.potion.Potion
@@ -152,4 +153,6 @@ object EntityUtils {
fun EntityLivingBase.getArmorInventory(): Array<ItemStack?>? =
if (this is EntityPlayer) inventory.armorInventory else null
+
+ fun EntityEnderman.getBlockInHand() = heldBlockState
} \ No newline at end of file