Discard a dead player's ender pearl when the rule says so

With ender_pearls_vanish_on_death on, a pearl thrown just before death
kept flying and pulled the respawned player back to it. Vanilla's
ThrownEnderpearl.tick discards the pearl instead of ticking it while
its owner is dead. Add a harness that throws a pearl, dies and respawns
on a dedicated server and compares the teleports with vanilla's.
This commit is contained in:
Kacpherek
2026-10-25 15:40:29 +01:00
parent bd591f9857
commit 10efca9e6c
3 changed files with 175 additions and 1 deletions
@@ -84,7 +84,10 @@ import net.minecraft.world.phys.Vec3;
* still), {@code sync NAME} (runs {@code time query gametime}, whose reply is
* not recorded, and prints {@code synced NAME} once it is back: the server has
* handled everything this player sent before, and everything the server sent
* this player before the reply has been recorded), {@code quit NAME}, {@code
* this player before the reply has been recorded), {@code respawn NAME} (the
* death screen's button, ServerboundClientCommandPacket PERFORM_RESPAWN),
* {@code use NAME PITCH} (the main hand's item used looking that way,
* ServerboundUseItemPacket), {@code quit NAME}, {@code
* players on|off} (whether each player also records the other players added
* to and removed from its level, and its own respawns into a dimension),
* {@code chat on|off} (whether the system chat each player receives is
@@ -130,6 +133,9 @@ public final class LocatorBarClient {
players.get(w[1]).send(new net.minecraft.network.protocol.game.ServerboundPlayerAbilitiesPacket(abilities));
}
case "still" -> players.get(w[1]).still();
case "respawn" -> players.get(w[1]).send(new net.minecraft.network.protocol.game.ServerboundClientCommandPacket(
net.minecraft.network.protocol.game.ServerboundClientCommandPacket.Action.PERFORM_RESPAWN));
case "use" -> players.get(w[1]).use(Float.parseFloat(w[2]));
case "sync" -> {
try {
players.get(w[1]).sync();
@@ -250,6 +256,13 @@ public final class LocatorBarClient {
}
}
private int sequence;
void use(float pitch) throws Exception {
send(new net.minecraft.network.protocol.game.ServerboundUseItemPacket(
net.minecraft.world.InteractionHand.MAIN_HAND, ++sequence, position.yRot(), pitch));
}
void still() throws Exception {
PositionMoveRotation at = position;
// A tick of its own: the server takes one position per client tick (receivedPositionThisTick).