Interface PlayerRespawnCallback
public interface PlayerRespawnCallback
Represents a callback for when a
ServerPlayer is respawned.
This occurs when a player dies, or changes dimensions, such as returning to the overworld from the end.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.fabricmc.fabric.api.event.Event<PlayerRespawnCallback> -
Method Summary
Modifier and TypeMethodDescriptionvoidonRespawn(net.minecraft.server.level.ServerPlayer newPlayer, net.minecraft.server.level.ServerPlayer oldPlayer, boolean isAlive) Called when a player respawns.
-
Field Details
-
EVENT
-
-
Method Details
-
onRespawn
void onRespawn(net.minecraft.server.level.ServerPlayer newPlayer, net.minecraft.server.level.ServerPlayer oldPlayer, boolean isAlive) Called when a player respawns.Note the player can be repositioned.
When this method is called,
newPlayerwill be at its spawn position.The player may be repositioned by callbacks to change where it respawns. The
oldPlayer's coordinates and world will be the same as before the respawn,Player's data has been copied from the
oldPlayertonewPlayer. The actual copied data depends on various factors such as the value ofisAliveor of thekeepInventoryGameRule.- Parameters:
newPlayer- The newServerPlayerthat will be spawned.oldPlayer- The oldServerPlayerthat is being removed.isAlive- Whether the old player is still alive.
-