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

Dragon tags & mechs #2620

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open

Dragon tags & mechs #2620

wants to merge 8 commits into from

Conversation

heypr
Copy link
Contributor

@heypr heypr commented May 8, 2024

  • Requested by Josh65.
  • Adds 3 paper-only, 1.20+ tags:
    • gateway_count
    • healing_crystals
    • respawn_crystals
  • Adds 1 paper-only, 1.20+ mechanism:
    • spawn_gateway
  • Adds 1 regular tag:
    • first_dragon_killed
  • Adds 4 regular mechanisms;
    • respawn_dragon
    • reset_crystals
    • respawn_phase
    • first_dragon_killed

I opened this as a draft PR because I haven't tested any of this/just wrote this up, and want it open so that I don't lose it in my sea of local and published branches. Feel free to comment/review though!

@heypr heypr marked this pull request as ready for review June 26, 2024 13:36
if (!mechanism.hasValue()) {
battle.spawnNewGateway();
}
if (mechanism.requireObject(LocationTag.class)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else if

// -->
tagProcessor.registerMechanism("respawn_dragon", false, (object, mechanism) -> {
if (object.getWorld() == null) {
mechanism.echoError("World '" + object.world_name + "' is unloaded, cannot set respawn phase.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... when is this a real concern?

// <--[mechanism]
// @object WorldTag
// @name respawn_phase
// @input ElementTag(String)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just ElementTag

// @returns ElementTag(Number)
// @description
// Returns the number of end gateway portals.
// Only works in end worlds.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick, but in sounds more like the player being in an end world while the script is running or something - maybe on, for, if the world is an end world, etc.?

// @attribute <WorldTag.healing_crystals>
// @returns ListTag(EntityTag)
// @description
// Returns a ListTag of the healing crystals located on top of the obsidian towers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd mention ender/end crystals as a search aid or in the description somewhere, healing crystals is technically right but most people probably won't know them by that name.

});

// <--[tag]
// @attribute <WorldTag.healing_crystals>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong tag name

// @Plugin Paper
// @group paper
// @description
// If no location is specified, tries to spawn a new end gateway using default game mechanics. Otherwise, spawns a new end gateway portal at the specified location.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, but meta is usually the other way around (spawns gateway at specified location, specify no input to spawn vanilla one)

battle.spawnNewGateway();
}
else if (mechanism.requireObject(LocationTag.class)) {
battle.spawnNewGateway(mechanism.getValue().asType(LocationTag.class, mechanism.context));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a #valueAsType iirc?

// @name respawn_phase
// @input ElementTag
// @description
// Set the current respawn phase of the ender dragon. Valid phases can be found at <@link url https://jd.papermc.io/paper/1.20/org/bukkit/boss/DragonBattle.RespawnPhase.html>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link doesn't seem to work?

Comment on lines +1068 to +1075
tagProcessor.registerMechanism("respawn_phase", false, ElementTag.class, (object, mechanism, input) -> {
DragonBattle battle = object.getWorld().getEnderDragonBattle();
if (battle == null) {
mechanism.echoError("Provided world is not an end world!");
return;
}
battle.setRespawnPhase(input.asEnum(DragonBattle.RespawnPhase.class));
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs Mechanism#requireEnum


// <--[mechanism]
// @object WorldTag
// @name respawn_phase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong name

Comment on lines +1087 to +1094
tagProcessor.registerMechanism("first_dragon_killed", false, ElementTag.class, (object, mechanism, input) -> {
DragonBattle battle = object.getWorld().getEnderDragonBattle();
if (battle == null) {
mechanism.echoError("Provided world is not an end world!");
return;
}
battle.setPreviouslyKilled(input.asBoolean());
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs Mechanism#requireBoolean

Comment on lines +1084 to +1085
// Set whether the first ender dragon was killed already.
// Only works in end worlds.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to document exactly what this does - does it reset the end and respawn the dragon? is it just a value that doesn't really affect anything?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants