aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-29 21:18:13 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-29 21:18:13 +0200
commit598ee0804c274d06a22156ab0f5361caf23e3c53 (patch)
tree39a4420a50fa7a1416ff7a70bd46986140825468 /src/main/java
parent37e7fce962d4e782fd0756ee9e87e3f888bf56f8 (diff)
downloadskyhanni-598ee0804c274d06a22156ab0f5361caf23e3c53.tar.gz
skyhanni-598ee0804c274d06a22156ab0f5361caf23e3c53.tar.bz2
skyhanni-598ee0804c274d06a22156ab0f5361caf23e3c53.zip
Fixed enderman slayer beacon shows very short.
Fixed enderman slayer line to beacon only shows when beacon highlight is enabled.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt76
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt8
4 files changed, 57 insertions, 38 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java
index 75cda0bd1..d05dcd06d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java
@@ -21,12 +21,12 @@ public class SlayerConfig {
public static class EndermanBeaconConfig {
@Expose
- @ConfigOption(name = "Enable",
+ @ConfigOption(name = "Highlight Beacon",
desc = "Highlight the Enderman Slayer Yang Glyph (beacon) in red color and added an timer when he explodes. " +
"Supports beacon in hand and beacon flying.")
@ConfigEditorBoolean
@FeatureToggle
- public boolean enabled = true;
+ public boolean highlightBeacon = true;
@Expose
@ConfigOption(name = "Show Warning", desc = "Displays a warning mid-screen then the Enderman Slayer throws a Yang Glyph (beacon).")
@@ -48,7 +48,7 @@ public class SlayerConfig {
@Expose
@ConfigOption(name = "Line Width", desc = "Width of the line.")
@ConfigEditorSlider(minStep = 1, minValue = 1, maxValue = 10)
- public int lineWidth = 1;
+ public int lineWidth = 3;
}
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
index 9948695bb..f0c6e214f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
@@ -18,6 +18,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation
+import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
import at.hannibal2.skyhanni.utils.SoundUtils.playSound
import kotlinx.coroutines.*
import net.minecraft.client.Minecraft
@@ -278,10 +279,8 @@ object VampireSlayerFeatures {
val vec = event.exactLocation(it)
val distance = start.distance(vec)
if (distance <= 15) {
- val player = Minecraft.getMinecraft().thePlayer
- val add = if (player.isSneaking) LorenzVec(0.0, 1.54, 0.0) else LorenzVec(0.0, 1.62, 0.0)
event.draw3DLine(
- event.exactLocation(player).add(add),
+ event.exactPlayerEyeLocation(),
vec.add(0.0, 1.54, 0.0),
config.lineColor.toChromaColor(),
config.lineWidth,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
index be9debe90..5a154c7cd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
@@ -9,6 +9,7 @@ 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.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
@@ -16,8 +17,8 @@ import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation
+import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
import at.hannibal2.skyhanni.utils.TimeUtils.format
-import net.minecraft.client.Minecraft
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.monster.EntityEnderman
import net.minecraft.init.Blocks
@@ -44,7 +45,7 @@ class EndermanSlayerFeatures {
if (entity in endermenWithBeacons || entity in flyingBeacons) return
if (entity is EntityEnderman) {
- if (beaconConfig.enabled) {
+ if (showBeacon()) {
if (hasBeaconInHand(entity) && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) {
endermenWithBeacons.add(entity)
logger.log("Added enderman with beacon at ${entity.getLorenzVec()}")
@@ -53,12 +54,12 @@ class EndermanSlayerFeatures {
}
if (entity is EntityArmorStand) {
- if (beaconConfig.showLine) {
+ if (showBeacon()) {
val stack = entity.inventory[4] ?: return
if (stack.name == "Beacon" && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) {
flyingBeacons.add(entity)
if (beaconConfig.showWarning)
- TitleUtils.sendTitle("§4Beacon", 2_00)
+ TitleUtils.sendTitle("§4Beacon", 2_000)
logger.log("Added flying beacons at ${entity.getLorenzVec()}")
}
}
@@ -78,11 +79,13 @@ class EndermanSlayerFeatures {
private fun canSee(a: LorenzVec, b: LorenzVec) = LocationUtils.canSee(a, b) || a.distance(b) < 15
+ private fun showBeacon() = beaconConfig.highlightBeacon || beaconConfig.showWarning || beaconConfig.showLine
+
@SubscribeEvent
fun onRenderMobColored(event: RenderMobColoredEvent) {
if (!IslandType.THE_END.isInIsland()) return
- if (beaconConfig.enabled && event.entity in flyingBeacons) {
+ if (beaconConfig.highlightBeacon && event.entity in flyingBeacons) {
event.color = LorenzColor.DARK_RED.toColor().withAlpha(1)
}
@@ -94,42 +97,55 @@ class EndermanSlayerFeatures {
@SubscribeEvent(priority = EventPriority.HIGH)
fun onWorldRender(event: RenderWorldLastEvent) {
if (!IslandType.THE_END.isInIsland()) return
- if (!beaconConfig.enabled) return
- endermenWithBeacons.removeIf { it.isDead || !hasBeaconInHand(it) }
- endermenWithBeacons.map { it.getLorenzVec().add(-0.5, 0.2, -0.5) }
- .forEach { event.drawColor(it, LorenzColor.DARK_RED, alpha = 1f) }
+ if (showBeacon()) {
+ endermenWithBeacons.removeIf { it.isDead || !hasBeaconInHand(it) }
+
+ endermenWithBeacons.map { it.getLorenzVec().add(-0.5, 0.2, -0.5) }
+ .forEach { event.drawColor(it, LorenzColor.DARK_RED, alpha = 1f) }
+ }
for ((location, time) in sittingBeacon) {
+ if (location.distanceToPlayer() > 20) continue
if (beaconConfig.showLine) {
- val distance = location.distance(location)
- if (distance <= 15) {
- val player = Minecraft.getMinecraft().thePlayer
- val add = if (player.isSneaking) LorenzVec(0.0, 1.54, 0.0) else LorenzVec(0.0, 1.62, 0.0)
- event.draw3DLine(
- event.exactLocation(player).add(add),
- location.add(0.5, 1.0, 0.5),
- beaconConfig.lneColor.toChromaColor(),
- beaconConfig.lineWidth,
- true
- )
- }
+ event.draw3DLine(
+ event.exactPlayerEyeLocation(),
+ location.add(0.5, 1.0, 0.5),
+ beaconConfig.lneColor.toChromaColor(),
+ beaconConfig.lineWidth,
+ true
+ )
}
- val duration = 5.seconds - time.passedSince()
- val durationFormat = duration.format(showMilliSeconds = true)
- event.drawColor(location, LorenzColor.DARK_RED, alpha = 1f)
- event.drawWaypointFilled(location, LorenzColor.RED.toColor(), true, true)
- event.drawDynamicText(location.add(0, 1, 0), "§4Beacon §b$durationFormat", 1.8)
+ if (beaconConfig.highlightBeacon) {
+ val duration = 5.seconds - time.passedSince()
+ val durationFormat = duration.format(showMilliSeconds = true)
+ event.drawColor(location, LorenzColor.DARK_RED, alpha = 1f)
+ event.drawWaypointFilled(location, LorenzColor.RED.toColor(), true, true)
+ event.drawDynamicText(location.add(0, 1, 0), "§4Beacon §b$durationFormat", 1.8)
+ }
}
for (beacon in flyingBeacons) {
- if (!beacon.isDead) {
- val location = event.exactLocation(beacon)
- event.drawDynamicText(location.add(0, 1, 0), "§4Beacon", 1.8)
+ if (beacon.isDead) continue
+ if (beaconConfig.highlightBeacon) {
+ val beaconLocation = event.exactLocation(beacon)
+ event.drawDynamicText(beaconLocation.add(0, 1, 0), "§4Beacon", 1.8)
+ }
+
+ if (beaconConfig.showLine) {
+ val beaconLocation = event.exactLocation(beacon)
+ event.draw3DLine(
+ event.exactPlayerEyeLocation(),
+ beaconLocation.add(0.5, 1.0, 0.5),
+ beaconConfig.lneColor.toChromaColor(),
+ beaconConfig.lineWidth,
+ true
+ )
}
}
+ config.endermanHighlightNukekebi
for (skull in nukekubiSkulls) {
if (!skull.isDead) {
event.drawDynamicText(
@@ -163,7 +179,7 @@ class EndermanSlayerFeatures {
@SubscribeEvent
fun onBlockChange(event: ServerBlockChangeEvent) {
if (!IslandType.THE_END.isInIsland()) return
- if (!beaconConfig.enabled) return
+ if (!showBeacon()) return
val location = event.location
if (event.new == "beacon") {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 64e68bec1..22d6cdaf3 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -707,8 +707,12 @@ object RenderUtils {
GlStateManager.enableDepth()
}
- fun RenderWorldLastEvent.exactLocation(entity: Entity): LorenzVec {
- return exactLocation(entity, partialTicks)
+ fun RenderWorldLastEvent.exactLocation(entity: Entity) = exactLocation(entity, partialTicks)
+
+ fun RenderWorldLastEvent.exactPlayerEyeLocation(): LorenzVec {
+ val player = Minecraft.getMinecraft().thePlayer
+ val add = if (player.isSneaking) LorenzVec(0.0, 1.54, 0.0) else LorenzVec(0.0, 1.62, 0.0)
+ return exactLocation(player).add(add)
}
fun exactLocation(entity: Entity, partialTicks: Float): LorenzVec {