Minestom 1.21.7
The 1.21.7 (including 1.21.6) branch has now been merged, thanks to all who tested and contributed to it!
Dialogs
Dialogs in Minestom are represented by a series of records starting from one of the Dialog
subclasses (looking at the required values should help to figure out how to construct them).
For example, here is the Dialog used for the Game Jam voting.
new ShowDialogPacket(new Dialog.Notice(
new DialogMetadata(
Component.text("Game Jam Scoring"),
null,
false,
false,
DialogAfterAction.CLOSE,
List.of(new DialogBody.Item(
ItemStack.of(Material.PAPER),
new DialogBody.PlainMessage(Component.text("Rate this game jam entry on each category from 1-5"), 400),
true, true, 40, 10
)),
List.of(
new DialogInput.NumberRange("technical", 200, Component.text("Technical"), "options.generic_value", 1, 5, 3f, 1f),
new DialogInput.NumberRange("theme", 200, Component.text("Theme"), "options.generic_value", 1, 5, 3f, 1f),
new DialogInput.NumberRange("fun", 200, Component.text("Fun"), "options.generic_value", 1, 5, 3f, 1f),
new DialogInput.NumberRange("originality", 200, Component.text("Originality"), "options.generic_value", 1, 5, 3f, 1f),
new DialogInput.NumberRange("visuals", 200, Component.text("Visuals"), "options.generic_value", 1, 5, 3f, 1f)
)
),
new DialogActionButton(
Component.text("Submit Scores"),
Component.text("§7Click to submit your scoring."),
100,
new DialogAction.DynamicCustom(Key.key("gamejam.submit_scores"), CompoundBinaryTag.builder().build())
)
));
To receive values you must use the DynamicCustom
dialog action (or dynamic command if you want to run a command directly). Using DialogAction.Custom
will not include the templated values. When a player performs the relevant action, a PlayerCustomClickEvent
(or PlayerConfigCustomClickEvent
if this happens in the configuration phase) will be emitted. For example:
globalEventHandler.addListener(PlayerCustomClickEvent.class, (event) -> {
if (event.getKey().equals(Key.key("gamejam.submit_scores"))) {
System.out.println("Game jam scores submitted by: " + event.getPlayer().getUsername());
System.out.println("Payload: " + event.getPayload());
}
});
Waypoints
Player locator bar waypoints are only exposed through the update waypoint packet (though I believe this API is sufficient). For example, to add a waypoint:
Player player = ...;
UUID theWaypointUuid = UUID.randomUUID();
Point somePosition = new Vec(50, 40, 50);
player.sendPacket(new TrackedWaypointPacket(TrackedWaypointPacket.Operation.TRACK, new TrackedWaypointPacket.Waypoint(
Either.left(theWaypointUuid),
TrackedWaypointPacket.Icon.DEFAULT,
new TrackedWaypointPacket.Target.Vec3i(somePosition)
)));
If adventure supports waypoints we will implement that API. If not, its possible we will add an API to manage waypoints separately, not sure yet.
Misc Changes
- The server list ping
ResponseData
has been replaced by an immutable builder (Status
). - Many uses of wall-clock milliseconds have been replaced with nano seconds (via
System.nanoTime()
to mitigate clock sync differences). - Painting and item frame orientation is now set via the direction metadata property. Paintings may not have an
UP
orDOWN
direction. - Adventure
GsonComponentSerializer
usages have been replaced with ourCodec.COMPONENT
, you are suggested to use this instead as well for better support. TagStringIOExt
has been removed as adventure now has native support for those operations. Adventure does not default to supporting heterogeneous lists in SNBT.MinestomAdventure.tagStringIO()
exposes an instance with heterogeneous lists enabled.
Misc Future Tasks
- Receiving transfers and correctly processing entity passenger/vehicle offsets remain as TODO items from 1.20.6.