mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-24 22:14:32 +00:00
[1.16.5] Backport OnDatapackSyncEvent from 1.17.1 (#7985)
This commit is contained in:
1 parent
c5725d1c61
commit
083624fb67
4 files changed
+86
-2
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.server.management.PlayerList;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
/**
|
||||
* Fires when a player joins the server or when the reload command is ran,
|
||||
* before tags and crafting recipes are sent to the client. Send datapack data
|
||||
* to clients when this event fires.
|
||||
*/
|
||||
public class OnDatapackSyncEvent extends Event
|
||||
{
|
||||
private final PlayerList playerList;
|
||||
@Nullable
|
||||
private final ServerPlayerEntity player;
|
||||
|
||||
public OnDatapackSyncEvent(PlayerList playerList, @Nullable ServerPlayerEntity player)
|
||||
{
|
||||
this.playerList = playerList;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The server's player list to get a view of all players.
|
||||
*/
|
||||
public PlayerList getPlayerList()
|
||||
{
|
||||
return this.playerList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The player to sync datapacks to. Null when syncing for all players,
|
||||
* such as when the reload command runs.
|
||||
*/
|
||||
@Nullable
|
||||
public ServerPlayerEntity getPlayer()
|
||||
{
|
||||
return this.player;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user