Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Line to Nukekebi Skull #2148

Merged
merged 7 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,38 @@ 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,
)
}
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(0.5, 1.0, 0.5),
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 +156,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(y = 1.0),
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 +248,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
Loading