Skip to content

Commit

Permalink
Feature: Line to Nukekebi Skull (#2148)
Browse files Browse the repository at this point in the history
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
  • Loading branch information
j10a1n15 and hannibal002 authored Jul 6, 2024
1 parent 06d4a20 commit d635862
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
public class SlayerConfig {

@Expose
@Category(name = "Endermen", desc = "Endermen Slayer Feature")
@Category(name = "Enderman", desc = "Enderman Slayer Feature")
@Accordion
// TODO rename to "enderman"
public EndermanConfig endermen = new EndermanConfig();

@Expose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ public class EndermanConfig {
@FeatureToggle
public boolean highlightNukekebi = false;

@Expose
@ConfigOption(name = "Line to Nukekubi Skulls", desc = "Draw a line to the Enderman Slayer Nukekubi Skulls.")
@ConfigEditorBoolean
@FeatureToggle
public boolean drawLineToNukekebi = false;

@Expose
@ConfigOption(name = "Phase Display", desc = "Show the current phase of the Enderman Slayer in damage indicator.")
@ConfigEditorBoolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ object EndermanSlayerFeatures {
flyingBeacons.add(entity)
RenderLivingEntityHelper.setEntityColor(
entity,
beaconConfig.beaconColor.toChromaColor().withAlpha(1)
beaconConfig.beaconColor.toChromaColor().withAlpha(1),
) {
beaconConfig.highlightBeacon
}
Expand All @@ -85,7 +85,7 @@ object EndermanSlayerFeatures {
nukekubiSkulls.add(entity)
RenderLivingEntityHelper.setEntityColor(
entity,
LorenzColor.GOLD.toColor().withAlpha(1)
LorenzColor.GOLD.toColor().withAlpha(1),
) { config.highlightNukekebi }
logger.log("Added Nukekubi skulls at ${entity.getLorenzVec()}")
}
Expand All @@ -102,7 +102,6 @@ object EndermanSlayerFeatures {
fun onWorldRender(event: LorenzRenderWorldEvent) {
if (!IslandType.THE_END.isInIsland()) return


if (beaconConfig.highlightBeacon) {
endermenWithBeacons.removeIf { it.isDead || !hasBeaconInHand(it) }

Expand All @@ -111,26 +110,39 @@ object EndermanSlayerFeatures {
}
}

for ((location, time) in sittingBeacon) {
if (location.distanceToPlayer() > 20) continue
if (beaconConfig.showLine) {
drawSittingBeacon(event)
drawFlyingBeacon(event)
drawNukekubiSkulls(event)
}

private fun drawNukekubiSkulls(event: LorenzRenderWorldEvent) {
for (skull in nukekubiSkulls) {
if (skull.isDead) continue
if (config.highlightNukekebi) {
event.drawDynamicText(
skull.getLorenzVec().add(-0.5, 1.5, -0.5),
"§6Nukekubi Skull",
1.6,
ignoreBlocks = false,
maxDistance = 20,
)
}
if (config.drawLineToNukekebi) {
val skullLocation = event.exactLocation(skull)
if (skullLocation.distanceToPlayer() > 20) continue
if (!skullLocation.canBeSeen()) continue
event.draw3DLine(
event.exactPlayerEyeLocation(),
location.add(0.5, 1.0, 0.5),
beaconConfig.lineColor.toChromaColor(),
beaconConfig.lineWidth,
true
skullLocation.add(y = 1),
LorenzColor.GOLD.toColor(),
3,
true,
)
}

if (beaconConfig.highlightBeacon) {
val duration = 5.seconds - time.passedSince()
val durationFormat = duration.format(showMilliSeconds = true)
event.drawColor(location, beaconConfig.beaconColor.toChromaColor(), alpha = 1f)
event.drawWaypointFilled(location, beaconConfig.beaconColor.toChromaColor(), true, true)
event.drawDynamicText(location.add(y = 1), "§4Beacon §b$durationFormat", 1.8)
}
}
}

private fun drawFlyingBeacon(event: LorenzRenderWorldEvent) {
for (beacon in flyingBeacons) {
if (beacon.isDead) continue
if (beaconConfig.highlightBeacon) {
Expand All @@ -145,21 +157,32 @@ object EndermanSlayerFeatures {
beaconLocation.add(0.5, 1.0, 0.5),
beaconConfig.lineColor.toChromaColor(),
beaconConfig.lineWidth,
true
true,
)
}
}
}

config.highlightNukekebi
for (skull in nukekubiSkulls) {
if (!skull.isDead) {
event.drawDynamicText(
skull.getLorenzVec().add(-0.5, 1.5, -0.5),
"§6Nukekubi Skull",
1.6,
ignoreBlocks = false
private fun drawSittingBeacon(event: LorenzRenderWorldEvent) {
for ((location, time) in sittingBeacon) {
if (location.distanceToPlayer() > 20) continue
if (beaconConfig.showLine) {
event.draw3DLine(
event.exactPlayerEyeLocation(),
location.add(0.5, 1.0, 0.5),
beaconConfig.lineColor.toChromaColor(),
beaconConfig.lineWidth,
true,
)
}

if (beaconConfig.highlightBeacon) {
val duration = 5.seconds - time.passedSince()
val durationFormat = duration.format(showMilliSeconds = true)
event.drawColor(location, beaconConfig.beaconColor.toChromaColor(), alpha = 1f)
event.drawWaypointFilled(location, beaconConfig.beaconColor.toChromaColor(), true, true)
event.drawDynamicText(location.add(y = 1), "§4Beacon §b$durationFormat", 1.8)
}
}
}

Expand Down Expand Up @@ -226,7 +249,7 @@ object EndermanSlayerFeatures {
event.move(
3,
"slayer.endermanBeaconConfig.highlightBeacon",
"slayer.endermen.endermanBeaconConfig.highlightBeacon"
"slayer.endermen.endermanBeaconConfig.highlightBeacon",
)
event.move(3, "slayer.endermanBeaconConfig.beaconColor", "slayer.endermen.endermanBeaconConfig.beaconColor")
event.move(3, "slayer.endermanBeaconConfig.showWarning", "slayer.endermen.endermanBeaconConfig.showWarning")
Expand Down

0 comments on commit d635862

Please sign in to comment.