net/minecraft/world/entity/item

random other server classes

Note: Scoreboards may need handling for the waypoints.

/net/minecraft/world/entity/animal/wolf

Also properly mark the item dropped when shearing as force drops
This commit is contained in:
Owen1212055
2025-05-29 21:00:05 -04:00
parent 6d71abd25f
commit f44197c4da
10 changed files with 156 additions and 212 deletions

View File

@@ -1,31 +0,0 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/item/component/ResolvableProfile.java b/net/minecraft/world/item/component/ResolvableProfile.java
index b990a4f1c97a8aeeffda47e12f5744a9b583f634..d60bd011747d381fdf23e9fe33c541590c92e9b7 100644
--- a/net/minecraft/world/item/component/ResolvableProfile.java
+++ b/net/minecraft/world/item/component/ResolvableProfile.java
@@ -20,9 +20,10 @@ public record ResolvableProfile(Optional<String> name, Optional<UUID> id, Proper
instance -> instance.group(
ExtraCodecs.PLAYER_NAME.optionalFieldOf("name").forGetter(ResolvableProfile::name),
UUIDUtil.CODEC.optionalFieldOf("id").forGetter(ResolvableProfile::id),
+ UUIDUtil.STRING_CODEC.lenientOptionalFieldOf("Id").forGetter($ -> Optional.empty()), // Paper
ExtraCodecs.PROPERTY_MAP.optionalFieldOf("properties", new PropertyMap()).forGetter(ResolvableProfile::properties)
)
- .apply(instance, ResolvableProfile::new)
+ .apply(instance, (name, uuid, uuid2, propertyMap) -> new ResolvableProfile(name, uuid2.or(() -> uuid), propertyMap)) // Paper
);
public static final Codec<ResolvableProfile> CODEC = Codec.withAlternative(
FULL_CODEC, ExtraCodecs.PLAYER_NAME, name -> new ResolvableProfile(Optional.of(name), Optional.empty(), new PropertyMap())
@@ -49,7 +50,7 @@ public record ResolvableProfile(Optional<String> name, Optional<UUID> id, Proper
if (this.isResolved()) {
return CompletableFuture.completedFuture(this);
} else {
- return this.id.isPresent() ? SkullBlockEntity.fetchGameProfile(this.id.get()).thenApply(optional -> {
+ return this.id.isPresent() ? SkullBlockEntity.fetchGameProfile(this.id.get(), this.name.orElse(null)).thenApply(optional -> { // Paper - player profile events
GameProfile gameProfile = optional.orElseGet(() -> new GameProfile(this.id.get(), this.name.orElse("")));
return new ResolvableProfile(gameProfile);
}) : SkullBlockEntity.fetchGameProfile(this.name.orElseThrow()).thenApply(optional -> {

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b82321f2feb25 100644
--- a/net/minecraft/server/Main.java --- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java
@@ -67,8 +67,10 @@ public class Main { @@ -68,8 +_,10 @@
reason = "System.out needed before bootstrap" reason = "System.out needed before bootstrap"
) )
@DontObfuscate @DontObfuscate
@@ -20,7 +12,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
OptionParser optionParser = new OptionParser(); OptionParser optionParser = new OptionParser();
OptionSpec<Void> optionSpec = optionParser.accepts("nogui"); OptionSpec<Void> optionSpec = optionParser.accepts("nogui");
OptionSpec<Void> optionSpec1 = optionParser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits"); OptionSpec<Void> optionSpec1 = optionParser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
@@ -93,41 +95,94 @@ public class Main { @@ -94,41 +_,94 @@
optionParser.printHelpOn(System.err); optionParser.printHelpOn(System.err);
return; return;
} }
@@ -124,7 +116,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
Dynamic<?> dataTag; Dynamic<?> dataTag;
if (levelStorageAccess.hasWorldData()) { if (levelStorageAccess.hasWorldData()) {
LevelSummary summary; LevelSummary summary;
@@ -169,12 +224,33 @@ public class Main { @@ -170,12 +_,33 @@
} }
Dynamic<?> dynamic = dataTag; Dynamic<?> dynamic = dataTag;
@@ -159,7 +151,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
WorldStem worldStem; WorldStem worldStem;
try { try {
@@ -183,6 +259,7 @@ public class Main { @@ -184,6 +_,7 @@
executor -> WorldLoader.load( executor -> WorldLoader.load(
initConfig, initConfig,
context -> { context -> {
@@ -167,7 +159,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
Registry<LevelStem> registry = context.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM); Registry<LevelStem> registry = context.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM);
if (dynamic != null) { if (dynamic != null) {
LevelDataAndDimensions levelDataAndDimensions = LevelStorageSource.getLevelDataAndDimensions( LevelDataAndDimensions levelDataAndDimensions = LevelStorageSource.getLevelDataAndDimensions(
@@ -196,7 +273,7 @@ public class Main { @@ -197,7 +_,7 @@
LevelSettings levelSettings; LevelSettings levelSettings;
WorldOptions worldOptions; WorldOptions worldOptions;
WorldDimensions worldDimensions; WorldDimensions worldDimensions;
@@ -176,7 +168,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
levelSettings = MinecraftServer.DEMO_SETTINGS; levelSettings = MinecraftServer.DEMO_SETTINGS;
worldOptions = WorldOptions.DEMO_OPTIONS; worldOptions = WorldOptions.DEMO_OPTIONS;
worldDimensions = WorldPresets.createNormalWorldDimensions(context.datapackWorldgen()); worldDimensions = WorldPresets.createNormalWorldDimensions(context.datapackWorldgen());
@@ -211,7 +288,7 @@ public class Main { @@ -212,7 +_,7 @@
new GameRules(context.dataConfiguration().enabledFeatures()), new GameRules(context.dataConfiguration().enabledFeatures()),
context.dataConfiguration() context.dataConfiguration()
); );
@@ -185,7 +177,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
worldDimensions = properties.createDimensions(context.datapackWorldgen()); worldDimensions = properties.createDimensions(context.datapackWorldgen());
} }
@@ -237,6 +314,7 @@ public class Main { @@ -238,6 +_,7 @@
return; return;
} }
@@ -193,7 +185,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
RegistryAccess.Frozen frozen = worldStem.registries().compositeAccess(); RegistryAccess.Frozen frozen = worldStem.registries().compositeAccess();
WorldData worldData = worldStem.worldData(); WorldData worldData = worldStem.worldData();
boolean hasOptionSpec1 = optionSet.has(optionSpec6); boolean hasOptionSpec1 = optionSet.has(optionSpec6);
@@ -245,9 +323,13 @@ public class Main { @@ -246,9 +_,13 @@
} }
levelStorageAccess.saveDataTag(frozen, worldData); levelStorageAccess.saveDataTag(frozen, worldData);
@@ -207,7 +199,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
thread1, thread1,
levelStorageAccess, levelStorageAccess,
packRepository, packRepository,
@@ -257,17 +339,34 @@ public class Main { @@ -258,18 +_,36 @@
services, services,
LoggerChunkProgressListener::createFromGameruleRadius LoggerChunkProgressListener::createFromGameruleRadius
); );
@@ -229,14 +221,16 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
if (flag && !GraphicsEnvironment.isHeadless()) { if (flag && !GraphicsEnvironment.isHeadless()) {
dedicatedServer1.showGui(); dedicatedServer1.showGui();
} }
+ // Paper start
+ if (optionSet.has("port")) { + if (optionSet.has("port")) {
+ int port = (Integer) optionSet.valueOf("port"); + int port = (Integer) optionSet.valueOf("port");
+ if (port > 0) { + if (port > 0) {
+ dedicatedServer1.setPort(port); + dedicatedServer1.setPort(port);
+ } + }
+ } + }
+ + // Paper end
GameTestTicker.SINGLETON.startTicking();
return dedicatedServer1; return dedicatedServer1;
} }
); );
@@ -244,7 +238,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
Thread thread = new Thread("Server Shutdown Thread") { Thread thread = new Thread("Server Shutdown Thread") {
@Override @Override
public void run() { public void run() {
@@ -276,6 +375,7 @@ public class Main { @@ -278,6 +_,7 @@
}; };
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
Runtime.getRuntime().addShutdownHook(thread); Runtime.getRuntime().addShutdownHook(thread);
@@ -252,7 +246,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
} catch (Exception var42) { } catch (Exception var42) {
LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", (Throwable)var42); LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", (Throwable)var42);
} }
@@ -317,7 +417,7 @@ public class Main { @@ -319,7 +_,7 @@
RegistryAccess registryAccess, RegistryAccess registryAccess,
boolean recreateRegionFiles boolean recreateRegionFiles
) { ) {

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java
index 9316688b6e7448c2f4805a399498e5562fa39f7c..52e0ae233a7b1c88bfbbc27707ef5f18453ec865 100644
--- a/net/minecraft/server/PlayerAdvancements.java --- a/net/minecraft/server/PlayerAdvancements.java
+++ b/net/minecraft/server/PlayerAdvancements.java +++ b/net/minecraft/server/PlayerAdvancements.java
@@ -47,7 +47,7 @@ import org.slf4j.Logger; @@ -47,7 +_,7 @@
public class PlayerAdvancements { public class PlayerAdvancements {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -17,7 +9,7 @@ index 9316688b6e7448c2f4805a399498e5562fa39f7c..52e0ae233a7b1c88bfbbc27707ef5f18
private final PlayerList playerList; private final PlayerList playerList;
private final Path playerSavePath; private final Path playerSavePath;
private AdvancementTree tree; private AdvancementTree tree;
@@ -60,6 +60,7 @@ public class PlayerAdvancements { @@ -60,6 +_,7 @@
private AdvancementHolder lastSelectedTab; private AdvancementHolder lastSelectedTab;
private boolean isFirstPacket = true; private boolean isFirstPacket = true;
private final Codec<PlayerAdvancements.Data> codec; private final Codec<PlayerAdvancements.Data> codec;
@@ -25,7 +17,7 @@ index 9316688b6e7448c2f4805a399498e5562fa39f7c..52e0ae233a7b1c88bfbbc27707ef5f18
public PlayerAdvancements(DataFixer dataFixer, PlayerList playerList, ServerAdvancementManager manager, Path playerSavePath, ServerPlayer player) { public PlayerAdvancements(DataFixer dataFixer, PlayerList playerList, ServerAdvancementManager manager, Path playerSavePath, ServerPlayer player) {
this.playerList = playerList; this.playerList = playerList;
@@ -128,6 +129,7 @@ public class PlayerAdvancements { @@ -127,6 +_,7 @@
} }
public void save() { public void save() {
@@ -33,7 +25,7 @@ index 9316688b6e7448c2f4805a399498e5562fa39f7c..52e0ae233a7b1c88bfbbc27707ef5f18
JsonElement jsonElement = this.codec.encodeStart(JsonOps.INSTANCE, this.asData()).getOrThrow(); JsonElement jsonElement = this.codec.encodeStart(JsonOps.INSTANCE, this.asData()).getOrThrow();
try { try {
@@ -145,6 +147,7 @@ public class PlayerAdvancements { @@ -144,6 +_,7 @@
data.forEach((path, progress) -> { data.forEach((path, progress) -> {
AdvancementHolder advancementHolder = advancementManager.get(path); AdvancementHolder advancementHolder = advancementManager.get(path);
if (advancementHolder == null) { if (advancementHolder == null) {
@@ -41,7 +33,7 @@ index 9316688b6e7448c2f4805a399498e5562fa39f7c..52e0ae233a7b1c88bfbbc27707ef5f18
LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", path, this.playerSavePath); LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", path, this.playerSavePath);
} else { } else {
this.startProgress(advancementHolder, progress); this.startProgress(advancementHolder, progress);
@@ -169,14 +172,31 @@ public class PlayerAdvancements { @@ -168,14 +_,31 @@
AdvancementProgress orStartProgress = this.getOrStartProgress(advancement); AdvancementProgress orStartProgress = this.getOrStartProgress(advancement);
boolean isDone = orStartProgress.isDone(); boolean isDone = orStartProgress.isDone();
if (orStartProgress.grantProgress(criterionKey)) { if (orStartProgress.grantProgress(criterionKey)) {
@@ -66,16 +58,16 @@ index 9316688b6e7448c2f4805a399498e5562fa39f7c..52e0ae233a7b1c88bfbbc27707ef5f18
+ // Paper end + // Paper end
advancement.value().rewards().grant(this.player); advancement.value().rewards().grant(this.player);
advancement.value().display().ifPresent(displayInfo -> { advancement.value().display().ifPresent(displayInfo -> {
- if (displayInfo.shouldAnnounceChat() && this.player.serverLevel().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { - if (displayInfo.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
- this.playerList.broadcastSystemMessage(displayInfo.getType().createAnnouncement(advancement, this.player), false); - this.playerList.broadcastSystemMessage(displayInfo.getType().createAnnouncement(advancement, this.player), false);
+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent + // Paper start - Add Adventure message to PlayerAdvancementDoneEvent
+ if (event.message() != null && this.player.serverLevel().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { + if (event.message() != null && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
+ this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false); + this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false);
+ // Paper end + // Paper end
} }
}); });
} }
@@ -247,7 +267,7 @@ public class PlayerAdvancements { @@ -246,7 +_,7 @@
public void flushDirty(ServerPlayer player, boolean showAdvancements) { public void flushDirty(ServerPlayer player, boolean showAdvancements) {
if (this.isFirstPacket || !this.rootsToUpdate.isEmpty() || !this.progressChanged.isEmpty()) { if (this.isFirstPacket || !this.rootsToUpdate.isEmpty() || !this.progressChanged.isEmpty()) {
Map<ResourceLocation, AdvancementProgress> map = new HashMap<>(); Map<ResourceLocation, AdvancementProgress> map = new HashMap<>();

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/server/ServerScoreboard.java b/net/minecraft/server/ServerScoreboard.java
index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a88942c8679e 100644
--- a/net/minecraft/server/ServerScoreboard.java --- a/net/minecraft/server/ServerScoreboard.java
+++ b/net/minecraft/server/ServerScoreboard.java +++ b/net/minecraft/server/ServerScoreboard.java
@@ -43,9 +43,7 @@ public class ServerScoreboard extends Scoreboard { @@ -45,9 +_,7 @@
protected void onScoreChanged(ScoreHolder scoreHolder, Objective objective, Score score) { protected void onScoreChanged(ScoreHolder scoreHolder, Objective objective, Score score) {
super.onScoreChanged(scoreHolder, objective, score); super.onScoreChanged(scoreHolder, objective, score);
if (this.trackedObjectives.contains(objective)) { if (this.trackedObjectives.contains(objective)) {
@@ -19,7 +11,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
new ClientboundSetScorePacket( new ClientboundSetScorePacket(
scoreHolder.getScoreboardName(), scoreHolder.getScoreboardName(),
objective.getName(), objective.getName(),
@@ -68,7 +66,7 @@ public class ServerScoreboard extends Scoreboard { @@ -70,7 +_,7 @@
@Override @Override
public void onPlayerRemoved(ScoreHolder scoreHolder) { public void onPlayerRemoved(ScoreHolder scoreHolder) {
super.onPlayerRemoved(scoreHolder); super.onPlayerRemoved(scoreHolder);
@@ -28,7 +20,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
this.setDirty(); this.setDirty();
} }
@@ -76,7 +74,7 @@ public class ServerScoreboard extends Scoreboard { @@ -78,7 +_,7 @@
public void onPlayerScoreRemoved(ScoreHolder scoreHolder, Objective objective) { public void onPlayerScoreRemoved(ScoreHolder scoreHolder, Objective objective) {
super.onPlayerScoreRemoved(scoreHolder, objective); super.onPlayerScoreRemoved(scoreHolder, objective);
if (this.trackedObjectives.contains(objective)) { if (this.trackedObjectives.contains(objective)) {
@@ -37,7 +29,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
} }
this.setDirty(); this.setDirty();
@@ -88,7 +86,7 @@ public class ServerScoreboard extends Scoreboard { @@ -90,7 +_,7 @@
super.setDisplayObjective(slot, objective); super.setDisplayObjective(slot, objective);
if (displayObjective != objective && displayObjective != null) { if (displayObjective != objective && displayObjective != null) {
if (this.getObjectiveDisplaySlotCount(displayObjective) > 0) { if (this.getObjectiveDisplaySlotCount(displayObjective) > 0) {
@@ -46,7 +38,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
} else { } else {
this.stopTrackingObjective(displayObjective); this.stopTrackingObjective(displayObjective);
} }
@@ -96,7 +94,7 @@ public class ServerScoreboard extends Scoreboard { @@ -98,7 +_,7 @@
if (objective != null) { if (objective != null) {
if (this.trackedObjectives.contains(objective)) { if (this.trackedObjectives.contains(objective)) {
@@ -55,7 +47,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
} else { } else {
this.startTrackingObjective(objective); this.startTrackingObjective(objective);
} }
@@ -108,9 +106,7 @@ public class ServerScoreboard extends Scoreboard { @@ -110,9 +_,7 @@
@Override @Override
public boolean addPlayerToTeam(String playerName, PlayerTeam team) { public boolean addPlayerToTeam(String playerName, PlayerTeam team) {
if (super.addPlayerToTeam(playerName, team)) { if (super.addPlayerToTeam(playerName, team)) {
@@ -63,10 +55,10 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
- .getPlayerList() - .getPlayerList()
- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD)); - .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD));
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD)); // CraftBukkit + this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD)); // CraftBukkit
this.updatePlayerWaypoint(playerName);
this.setDirty(); this.setDirty();
return true; return true;
} else { @@ -121,16 +_,44 @@
@@ -118,15 +114,43 @@ public class ServerScoreboard extends Scoreboard {
} }
} }
@@ -96,6 +88,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
- .getPlayerList() - .getPlayerList()
- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE)); - .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE));
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE)); // CraftBukkit + this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE)); // CraftBukkit
this.updatePlayerWaypoint(username);
this.setDirty(); this.setDirty();
} }
@@ -113,7 +106,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
@Override @Override
public void onObjectiveAdded(Objective objective) { public void onObjectiveAdded(Objective objective) {
super.onObjectiveAdded(objective); super.onObjectiveAdded(objective);
@@ -137,7 +161,7 @@ public class ServerScoreboard extends Scoreboard { @@ -141,7 +_,7 @@
public void onObjectiveChanged(Objective objective) { public void onObjectiveChanged(Objective objective) {
super.onObjectiveChanged(objective); super.onObjectiveChanged(objective);
if (this.trackedObjectives.contains(objective)) { if (this.trackedObjectives.contains(objective)) {
@@ -122,7 +115,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
} }
this.setDirty(); this.setDirty();
@@ -156,21 +180,21 @@ public class ServerScoreboard extends Scoreboard { @@ -160,14 +_,14 @@
@Override @Override
public void onTeamAdded(PlayerTeam playerTeam) { public void onTeamAdded(PlayerTeam playerTeam) {
super.onTeamAdded(playerTeam); super.onTeamAdded(playerTeam);
@@ -136,18 +129,19 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
super.onTeamChanged(playerTeam); super.onTeamChanged(playerTeam);
- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, false)); - this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, false));
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, false)); // CraftBukkit + this.broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, false)); // CraftBukkit
this.updateTeamWaypoints(playerTeam);
this.setDirty(); this.setDirty();
} }
@@ -175,7 +_,7 @@
@Override @Override
public void onTeamRemoved(PlayerTeam playerTeam) { public void onTeamRemoved(PlayerTeam playerTeam) {
super.onTeamRemoved(playerTeam); super.onTeamRemoved(playerTeam);
- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createRemovePacket(playerTeam)); - this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createRemovePacket(playerTeam));
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createRemovePacket(playerTeam)); // CraftBukkit + this.broadcastAll(ClientboundSetPlayerTeamPacket.createRemovePacket(playerTeam)); // CraftBukkit
this.updateTeamWaypoints(playerTeam);
this.setDirty(); this.setDirty();
} }
@@ -219,6 +_,7 @@
@@ -213,6 +237,7 @@ public class ServerScoreboard extends Scoreboard {
List<Packet<?>> startTrackingPackets = this.getStartTrackingPackets(objective); List<Packet<?>> startTrackingPackets = this.getStartTrackingPackets(objective);
for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) { for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
@@ -155,7 +149,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
for (Packet<?> packet : startTrackingPackets) { for (Packet<?> packet : startTrackingPackets) {
serverPlayer.connection.send(packet); serverPlayer.connection.send(packet);
} }
@@ -238,6 +263,7 @@ public class ServerScoreboard extends Scoreboard { @@ -244,6 +_,7 @@
List<Packet<?>> stopTrackingPackets = this.getStopTrackingPackets(objective); List<Packet<?>> stopTrackingPackets = this.getStopTrackingPackets(objective);
for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) { for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
@@ -163,10 +157,10 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
for (Packet<?> packet : stopTrackingPackets) { for (Packet<?> packet : stopTrackingPackets) {
serverPlayer.connection.send(packet); serverPlayer.connection.send(packet);
} }
@@ -270,6 +296,16 @@ public class ServerScoreboard extends Scoreboard { @@ -295,4 +_,13 @@
return scoreboardSaveData; .forEach(serverPlayer -> serverLevel.getWaypointManager().remakeConnections(serverPlayer));
}
} }
+ // CraftBukkit start - Send to players + // CraftBukkit start - Send to players
+ private void broadcastAll(Packet<?> packet) { + private void broadcastAll(Packet<?> packet) {
+ for (ServerPlayer serverPlayer : this.server.getPlayerList().players) { + for (ServerPlayer serverPlayer : this.server.getPlayerList().players) {
@@ -176,7 +170,4 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
+ } + }
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ }
public static enum Method {
CHANGE,
REMOVE;

View File

@@ -1145,6 +1145,16 @@
} }
if (flag) { if (flag) {
@@ -2192,7 +_,9 @@
this.gameEvent(GameEvent.SHEAR, player);
this.playSound(equippable.shearingSound().value());
if (this.level() instanceof ServerLevel serverLevel) {
+ this.forceDrops = true; // Paper
this.spawnAtLocation(serverLevel, itemBySlot, average);
+ this.forceDrops = false; // Paper
}
return true;
@@ -2264,11 +_,11 @@ @@ -2264,11 +_,11 @@
} }

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/animal/wolf/Wolf.java b/net/minecraft/world/entity/animal/wolf/Wolf.java
index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b811ee649 100644
--- a/net/minecraft/world/entity/animal/wolf/Wolf.java --- a/net/minecraft/world/entity/animal/wolf/Wolf.java
+++ b/net/minecraft/world/entity/animal/wolf/Wolf.java +++ b/net/minecraft/world/entity/animal/wolf/Wolf.java
@@ -400,16 +400,18 @@ public class Wolf extends TamableAnimal implements NeutralMob { @@ -399,16 +_,18 @@
if (this.isInvulnerableTo(level, damageSource)) { if (this.isInvulnerableTo(level, damageSource)) {
return false; return false;
} else { } else {
@@ -30,7 +22,7 @@ index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b
ItemStack bodyArmorItem = this.getBodyArmorItem(); ItemStack bodyArmorItem = this.getBodyArmorItem();
int damageValue = bodyArmorItem.getDamageValue(); int damageValue = bodyArmorItem.getDamageValue();
int maxDamage = bodyArmorItem.getMaxDamage(); int maxDamage = bodyArmorItem.getMaxDamage();
@@ -429,6 +431,7 @@ public class Wolf extends TamableAnimal implements NeutralMob { @@ -428,6 +_,7 @@
); );
} }
} }
@@ -38,7 +30,7 @@ index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b
} }
private boolean canArmorAbsorb(DamageSource damageSource) { private boolean canArmorAbsorb(DamageSource damageSource) {
@@ -439,7 +442,7 @@ public class Wolf extends TamableAnimal implements NeutralMob { @@ -438,7 +_,7 @@
protected void applyTamingSideEffects() { protected void applyTamingSideEffects() {
if (this.isTame()) { if (this.isTame()) {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(40.0); this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(40.0);
@@ -47,7 +39,7 @@ index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b
} else { } else {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(8.0); this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(8.0);
} }
@@ -459,7 +462,7 @@ public class Wolf extends TamableAnimal implements NeutralMob { @@ -463,7 +_,7 @@
this.usePlayerItem(player, hand, itemInHand); this.usePlayerItem(player, hand, itemInHand);
FoodProperties foodProperties = itemInHand.get(DataComponents.FOOD); FoodProperties foodProperties = itemInHand.get(DataComponents.FOOD);
float f = foodProperties != null ? foodProperties.nutrition() : 1.0F; float f = foodProperties != null ? foodProperties.nutrition() : 1.0F;
@@ -56,7 +48,7 @@ index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
@@ -492,7 +495,7 @@ public class Wolf extends TamableAnimal implements NeutralMob { @@ -492,7 +_,7 @@
this.setOrderedToSit(!this.isOrderedToSit()); this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false; this.jumping = false;
this.navigation.stop(); this.navigation.stop();
@@ -65,17 +57,7 @@ index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b
return InteractionResult.SUCCESS.withoutItem(); return InteractionResult.SUCCESS.withoutItem();
} }
@@ -504,7 +507,9 @@ public class Wolf extends TamableAnimal implements NeutralMob { @@ -501,6 +_,13 @@
ItemStack bodyArmorItem = this.getBodyArmorItem();
this.setBodyArmorItem(ItemStack.EMPTY);
if (this.level() instanceof ServerLevel serverLevel) {
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation(serverLevel, bodyArmorItem);
+ this.forceDrops = false; // CraftBukkit
}
return InteractionResult.SUCCESS;
@@ -512,6 +517,13 @@ public class Wolf extends TamableAnimal implements NeutralMob {
DyeColor dyeColor = dyeItem.getDyeColor(); DyeColor dyeColor = dyeItem.getDyeColor();
if (dyeColor != this.getCollarColor()) { if (dyeColor != this.getCollarColor()) {
@@ -89,7 +71,7 @@ index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b
this.setCollarColor(dyeColor); this.setCollarColor(dyeColor);
itemInHand.consume(1, player); itemInHand.consume(1, player);
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
@@ -526,7 +538,7 @@ public class Wolf extends TamableAnimal implements NeutralMob { @@ -515,7 +_,7 @@
} }
private void tryToTame(Player player) { private void tryToTame(Player player) {

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf377b47466 100644
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -69,6 +69,7 @@ public class FallingBlockEntity extends Entity { @@ -72,6 +_,7 @@
public CompoundTag blockData; public CompoundTag blockData;
public boolean forceTickAfterTeleportToDuplicate; public boolean forceTickAfterTeleportToDuplicate;
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS); protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
@@ -16,7 +8,7 @@ index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf3
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) { public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -94,6 +95,7 @@ public class FallingBlockEntity extends Entity { @@ -97,6 +_,7 @@
pos.getZ() + 0.5, pos.getZ() + 0.5,
blockState.hasProperty(BlockStateProperties.WATERLOGGED) ? blockState.setValue(BlockStateProperties.WATERLOGGED, false) : blockState blockState.hasProperty(BlockStateProperties.WATERLOGGED) ? blockState.setValue(BlockStateProperties.WATERLOGGED, false) : blockState
); );
@@ -24,7 +16,7 @@ index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf3
level.setBlock(pos, blockState.getFluidState().createLegacyBlock(), 3); level.setBlock(pos, blockState.getFluidState().createLegacyBlock(), 3);
level.addFreshEntity(fallingBlockEntity); level.addFreshEntity(fallingBlockEntity);
return fallingBlockEntity; return fallingBlockEntity;
@@ -144,13 +146,22 @@ public class FallingBlockEntity extends Entity { @@ -147,13 +_,22 @@
@Override @Override
public void tick() { public void tick() {
if (this.blockState.isAir()) { if (this.blockState.isAir()) {
@@ -48,7 +40,7 @@ index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf3
this.handlePortal(); this.handlePortal();
if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) { if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) {
BlockPos blockPos = this.blockPosition(); BlockPos blockPos = this.blockPosition();
@@ -171,12 +182,12 @@ public class FallingBlockEntity extends Entity { @@ -174,12 +_,12 @@
} }
if (!this.onGround() && !flag1) { if (!this.onGround() && !flag1) {
@@ -63,7 +55,7 @@ index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf3
} }
} else { } else {
BlockState blockState = this.level().getBlockState(blockPos); BlockState blockState = this.level().getBlockState(blockPos);
@@ -194,12 +205,18 @@ public class FallingBlockEntity extends Entity { @@ -197,12 +_,18 @@
this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, true); this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
} }
@@ -83,7 +75,7 @@ index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf3
if (block instanceof Fallable) { if (block instanceof Fallable) {
((Fallable)block).onLand(this.level(), blockPos, this.blockState, blockState, this); ((Fallable)block).onLand(this.level(), blockPos, this.blockState, blockState, this);
} }
@@ -220,19 +237,19 @@ public class FallingBlockEntity extends Entity { @@ -227,19 +_,19 @@
} }
} }
} else if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { } else if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
@@ -106,26 +98,26 @@ index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf3
this.callOnBrokenAfterFall(block, blockPos); this.callOnBrokenAfterFall(block, blockPos);
} }
} }
@@ -293,6 +310,7 @@ public class FallingBlockEntity extends Entity { @@ -299,6 +_,7 @@
} }
compound.putBoolean("CancelDrop", this.cancelDrop); output.putBoolean("CancelDrop", this.cancelDrop);
+ if (!this.autoExpire) compound.putBoolean("Paper.AutoExpire", false); // Paper - Expand FallingBlock API + if (!this.autoExpire) output.putBoolean("Paper.AutoExpire", false); // Paper - Expand FallingBlock API
} }
@Override @Override
@@ -305,8 +323,9 @@ public class FallingBlockEntity extends Entity { @@ -310,8 +_,9 @@
this.fallDamagePerDistance = compound.getFloatOr("FallHurtAmount", 0.0F); this.fallDamagePerDistance = input.getFloatOr("FallHurtAmount", 0.0F);
this.fallDamageMax = compound.getIntOr("FallHurtMax", 40); this.fallDamageMax = input.getIntOr("FallHurtMax", 40);
this.dropItem = compound.getBooleanOr("DropItem", true); this.dropItem = input.getBooleanOr("DropItem", true);
- this.blockData = compound.getCompound("TileEntityData").map(CompoundTag::copy).orElse(null); - this.blockData = input.read("TileEntityData", CompoundTag.CODEC).orElse(null);
+ this.blockData = compound.getCompound("TileEntityData").map(blockData -> this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock ? null : blockData).map(CompoundTag::copy).orElse(null); // Paper - Filter bad block entity nbt data from falling blocks + this.blockData = input.read("TileEntityData", CompoundTag.CODEC).map(blockData -> this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock ? null : blockData).map(CompoundTag::copy).orElse(null); // Paper - Filter bad block entity nbt data from falling blocks
this.cancelDrop = compound.getBooleanOr("CancelDrop", false); this.cancelDrop = input.getBooleanOr("CancelDrop", false);
+ this.autoExpire = compound.getBooleanOr("Paper.AutoExpire", true); // Paper - Expand FallingBlock API + this.autoExpire = input.getBooleanOr("Paper.AutoExpire", true); // Paper - Expand FallingBlock API
} }
public void setHurtsEntities(float fallDamagePerDistance, int fallDamageMax) { public void setHurtsEntities(float fallDamagePerDistance, int fallDamageMax) {
@@ -363,7 +382,7 @@ public class FallingBlockEntity extends Entity { @@ -368,7 +_,7 @@
ResourceKey<Level> resourceKey1 = this.level().dimension(); ResourceKey<Level> resourceKey1 = this.level().dimension();
boolean flag = (resourceKey1 == Level.END || resourceKey == Level.END) && resourceKey1 != resourceKey; boolean flag = (resourceKey1 == Level.END || resourceKey == Level.END) && resourceKey1 != resourceKey;
Entity entity = super.teleport(teleportTransition); Entity entity = super.teleport(teleportTransition);

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java
index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972d2c832e6 100644
--- a/net/minecraft/world/entity/item/ItemEntity.java --- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -56,6 +56,9 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -53,6 +_,9 @@
@Nullable @Nullable
public UUID target; public UUID target;
public final float bobOffs; public final float bobOffs;
@@ -18,7 +10,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) { public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -64,7 +67,12 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -61,7 +_,12 @@
} }
public ItemEntity(Level level, double posX, double posY, double posZ, ItemStack itemStack) { public ItemEntity(Level level, double posX, double posY, double posZ, ItemStack itemStack) {
@@ -32,7 +24,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
} }
public ItemEntity(Level level, double posX, double posY, double posZ, ItemStack itemStack, double deltaX, double deltaY, double deltaZ) { public ItemEntity(Level level, double posX, double posY, double posZ, ItemStack itemStack, double deltaX, double deltaY, double deltaZ) {
@@ -126,7 +134,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -116,7 +_,7 @@
@Override @Override
public void tick() { public void tick() {
if (this.getItem().isEmpty()) { if (this.getItem().isEmpty()) {
@@ -41,7 +33,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
} else { } else {
super.tick(); super.tick();
if (this.pickupDelay > 0 && this.pickupDelay != 32767) { if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
@@ -154,11 +162,15 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -144,11 +_,15 @@
} }
} }
@@ -59,7 +51,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F;
} }
@@ -191,8 +203,14 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -181,8 +_,14 @@
} }
} }
@@ -76,7 +68,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
} }
} }
} }
@@ -217,9 +235,18 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -207,9 +_,18 @@
private void mergeWithNeighbours() { private void mergeWithNeighbours() {
if (this.isMergable()) { if (this.isMergable()) {
@@ -96,7 +88,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
this.tryToMerge(itemEntity); this.tryToMerge(itemEntity);
if (this.isRemoved()) { if (this.isRemoved()) {
break; break;
@@ -231,7 +258,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -221,7 +_,7 @@
private boolean isMergable() { private boolean isMergable() {
ItemStack item = this.getItem(); ItemStack item = this.getItem();
@@ -105,7 +97,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
} }
private void tryToMerge(ItemEntity itemEntity) { private void tryToMerge(ItemEntity itemEntity) {
@@ -264,11 +291,16 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -254,11 +_,16 @@
} }
private static void merge(ItemEntity destinationEntity, ItemStack destinationStack, ItemEntity originEntity, ItemStack originStack) { private static void merge(ItemEntity destinationEntity, ItemStack destinationStack, ItemEntity originEntity, ItemStack originStack) {
@@ -123,7 +115,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
} }
} }
@@ -296,12 +328,17 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -286,12 +_,17 @@
} else if (!this.getItem().canBeHurtBy(damageSource)) { } else if (!this.getItem().canBeHurtBy(damageSource)) {
return false; return false;
} else { } else {
@@ -142,25 +134,24 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
} }
return true; return true;
@@ -324,6 +361,11 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -313,6 +_,11 @@
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); if (!this.getItem().isEmpty()) {
compound.store("Item", ItemStack.CODEC, registryOps, this.getItem()); output.store("Item", ItemStack.CODEC, this.getItem());
} }
+ // Paper start - Friction API + // Paper start - Friction API
+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) { + if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) {
+ compound.putString("Paper.FrictionState", this.frictionState.toString()); + output.putString("Paper.FrictionState", this.frictionState.toString());
+ } + }
+ // Paper end - Friction API + // Paper end - Friction API
} }
@Override @Override
@@ -336,8 +378,19 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -323,8 +_,17 @@
this.cachedThrower = null; this.target = input.read("Owner", UUIDUtil.CODEC).orElse(null);
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); this.thrower = EntityReference.read(input, "Thrower");
this.setItem(compound.read("Item", ItemStack.CODEC, registryOps).orElse(ItemStack.EMPTY)); this.setItem(input.read("Item", ItemStack.CODEC).orElse(ItemStack.EMPTY));
+
+ // Paper start - Friction API + // Paper start - Friction API
+ compound.getString("Paper.FrictionState").ifPresent(frictionState -> { + input.getString("Paper.FrictionState").ifPresent(frictionState -> {
+ try { + try {
+ this.frictionState = net.kyori.adventure.util.TriState.valueOf(frictionState); + this.frictionState = net.kyori.adventure.util.TriState.valueOf(frictionState);
+ } catch (Exception ignored) { + } catch (Exception ignored) {
@@ -168,14 +159,13 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
+ } + }
+ }); + });
+ // Paper end - Friction API + // Paper end - Friction API
+
if (this.getItem().isEmpty()) { if (this.getItem().isEmpty()) {
- this.discard(); - this.discard();
+ this.discard(null); // CraftBukkit - add Bukkit remove cause + this.discard(null); // CraftBukkit - add Bukkit remove cause
} }
} }
@@ -347,10 +400,73 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -334,10 +_,73 @@
ItemStack item = this.getItem(); ItemStack item = this.getItem();
Item item1 = item.getItem(); Item item1 = item.getItem();
int count = item.getCount(); int count = item.getCount();
@@ -250,7 +240,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
item.setCount(count); item.setCount(count);
} }
@@ -388,6 +504,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -375,6 +_,7 @@
public void setItem(ItemStack stack) { public void setItem(ItemStack stack) {
this.getEntityData().set(DATA_ITEM, stack); this.getEntityData().set(DATA_ITEM, stack);
@@ -258,7 +248,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
} }
@Override @Override
@@ -441,7 +558,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -427,7 +_,7 @@
public void makeFakeItem() { public void makeFakeItem() {
this.setNeverPickUp(); this.setNeverPickUp();

View File

@@ -0,0 +1,32 @@
--- a/net/minecraft/world/item/component/ResolvableProfile.java
+++ b/net/minecraft/world/item/component/ResolvableProfile.java
@@ -21,9 +_,10 @@
instance -> instance.group(
ExtraCodecs.PLAYER_NAME.optionalFieldOf("name").forGetter(ResolvableProfile::name),
UUIDUtil.CODEC.optionalFieldOf("id").forGetter(ResolvableProfile::id),
+ UUIDUtil.STRING_CODEC.lenientOptionalFieldOf("Id").forGetter($ -> Optional.empty()), // Paper
ExtraCodecs.PROPERTY_MAP.optionalFieldOf("properties", new PropertyMap()).forGetter(ResolvableProfile::properties)
)
- .apply(instance, ResolvableProfile::new)
+ .apply(instance, (name, uuid, uuid2, propertyMap) -> new ResolvableProfile(name, uuid2.or(() -> uuid), propertyMap)) // Paper
);
public static final Codec<ResolvableProfile> CODEC = Codec.withAlternative(
FULL_CODEC, ExtraCodecs.PLAYER_NAME, name -> new ResolvableProfile(Optional.of(name), Optional.empty(), new PropertyMap())
@@ -53,7 +_,7 @@
} else {
Optional<GameProfile> optional;
if (this.id.isPresent()) {
- optional = SkullBlockEntity.fetchGameProfile(this.id.get()).getNow(null);
+ optional = SkullBlockEntity.fetchGameProfile(this.id.get(), this.name.orElse(null)).getNow(null); // Paper
} else {
optional = SkullBlockEntity.fetchGameProfile(this.name.orElseThrow()).getNow(null);
}
@@ -67,7 +_,7 @@
return CompletableFuture.completedFuture(this);
} else {
return this.id.isPresent()
- ? SkullBlockEntity.fetchGameProfile(this.id.get()).thenApply(this::createProfile)
+ ? SkullBlockEntity.fetchGameProfile(this.id.get(), this.name.orElse(null)).thenApply(this::createProfile) // Paper
: SkullBlockEntity.fetchGameProfile(this.name.orElseThrow()).thenApply(this::createProfile);
}
}

View File

@@ -1,14 +1,6 @@
From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001
From: File <noreply+automated@papermc.io>
Date: Sun, 20 Apr 1997 15:37:42 +0200
Subject: [PATCH] paper File Patches
diff --git a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc58a36186a 100644
--- a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java --- a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -52,6 +52,16 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -52,6 +_,16 @@
this.entityGetter = new LevelEntityGetterAdapter<>(this.visibleEntityStorage, this.sectionStorage); this.entityGetter = new LevelEntityGetterAdapter<>(this.visibleEntityStorage, this.sectionStorage);
} }
@@ -25,7 +17,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
void removeSectionIfEmpty(long sectionKey, EntitySection<T> section) { void removeSectionIfEmpty(long sectionKey, EntitySection<T> section) {
if (section.isEmpty()) { if (section.isEmpty()) {
this.sectionStorage.remove(sectionKey); this.sectionStorage.remove(sectionKey);
@@ -59,6 +69,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -59,6 +_,7 @@
} }
private boolean addEntityUuid(T entity) { private boolean addEntityUuid(T entity) {
@@ -33,7 +25,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
if (!this.knownUuids.add(entity.getUUID())) { if (!this.knownUuids.add(entity.getUUID())) {
LOGGER.warn("UUID of added entity already exists: {}", entity); LOGGER.warn("UUID of added entity already exists: {}", entity);
return false; return false;
@@ -72,6 +83,17 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -72,6 +_,17 @@
} }
private boolean addEntity(T entity, boolean worldGenSpawned) { private boolean addEntity(T entity, boolean worldGenSpawned) {
@@ -51,7 +43,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
if (!this.addEntityUuid(entity)) { if (!this.addEntityUuid(entity)) {
return false; return false;
} else { } else {
@@ -113,19 +135,23 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -113,19 +_,23 @@
} }
void startTicking(T entity) { void startTicking(T entity) {
@@ -75,7 +67,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
this.callbacks.onTrackingEnd(entity); this.callbacks.onTrackingEnd(entity);
this.visibleEntityStorage.remove(entity); this.visibleEntityStorage.remove(entity);
} }
@@ -136,6 +162,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -136,6 +_,7 @@
} }
public void updateChunkStatus(ChunkPos pos, Visibility visibility) { public void updateChunkStatus(ChunkPos pos, Visibility visibility) {
@@ -83,7 +75,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
long packedChunkPos = pos.toLong(); long packedChunkPos = pos.toLong();
if (visibility == Visibility.HIDDEN) { if (visibility == Visibility.HIDDEN) {
this.chunkVisibility.remove(packedChunkPos); this.chunkVisibility.remove(packedChunkPos);
@@ -169,6 +196,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -169,6 +_,7 @@
} }
public void ensureChunkQueuedForLoad(long chunkPosValue) { public void ensureChunkQueuedForLoad(long chunkPosValue) {
@@ -91,7 +83,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue); PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue);
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.FRESH) { if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.FRESH) {
this.requestChunkLoad(chunkPosValue); this.requestChunkLoad(chunkPosValue);
@@ -176,6 +204,11 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -176,6 +_,11 @@
} }
private boolean storeChunkSections(long chunkPosValue, Consumer<T> entityAction) { private boolean storeChunkSections(long chunkPosValue, Consumer<T> entityAction) {
@@ -103,7 +95,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue); PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue);
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.PENDING) { if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.PENDING) {
return false; return false;
@@ -186,6 +219,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -186,6 +_,7 @@
.collect(Collectors.toList()); .collect(Collectors.toList());
if (list.isEmpty()) { if (list.isEmpty()) {
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.LOADED) { if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.LOADED) {
@@ -111,7 +103,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), ImmutableList.of())); this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), ImmutableList.of()));
} }
@@ -194,6 +228,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -194,6 +_,7 @@
this.requestChunkLoad(chunkPosValue); this.requestChunkLoad(chunkPosValue);
return false; return false;
} else { } else {
@@ -119,7 +111,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), list)); this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), list));
list.forEach(entityAction); list.forEach(entityAction);
return true; return true;
@@ -202,6 +237,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -202,6 +_,7 @@
} }
private void requestChunkLoad(long chunkPosValue) { private void requestChunkLoad(long chunkPosValue) {
@@ -127,7 +119,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
this.chunkLoadStatuses.put(chunkPosValue, PersistentEntitySectionManager.ChunkLoadStatus.PENDING); this.chunkLoadStatuses.put(chunkPosValue, PersistentEntitySectionManager.ChunkLoadStatus.PENDING);
ChunkPos chunkPos = new ChunkPos(chunkPosValue); ChunkPos chunkPos = new ChunkPos(chunkPosValue);
this.permanentStorage.loadEntities(chunkPos).thenAccept(this.loadingInbox::add).exceptionally(throwable -> { this.permanentStorage.loadEntities(chunkPos).thenAccept(this.loadingInbox::add).exceptionally(throwable -> {
@@ -211,7 +247,8 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -211,7 +_,8 @@
} }
private boolean processChunkUnload(long chunkPosValue) { private boolean processChunkUnload(long chunkPosValue) {
@@ -137,7 +129,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
if (!flag) { if (!flag) {
return false; return false;
} else { } else {
@@ -221,7 +258,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -221,7 +_,7 @@
} }
private void unloadEntity(EntityAccess entity) { private void unloadEntity(EntityAccess entity) {
@@ -146,10 +138,10 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
entity.setLevelCallback(EntityInLevelCallback.NULL); entity.setLevelCallback(EntityInLevelCallback.NULL);
} }
@@ -231,14 +268,20 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -231,14 +_,20 @@
} }
private void processPendingLoads() { public void processPendingLoads() {
+ org.spigotmc.AsyncCatcher.catchOp("Entity chunk process pending loads"); // Paper + org.spigotmc.AsyncCatcher.catchOp("Entity chunk process pending loads"); // Paper
ChunkEntities<T> chunkEntities; ChunkEntities<T> chunkEntities;
while ((chunkEntities = this.loadingInbox.poll()) != null) { while ((chunkEntities = this.loadingInbox.poll()) != null) {
@@ -167,7 +159,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
this.processPendingLoads(); this.processPendingLoads();
this.processUnloads(); this.processUnloads();
} }
@@ -256,6 +299,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -256,6 +_,7 @@
} }
public void autoSave() { public void autoSave() {
@@ -175,7 +167,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
this.getAllChunksToSave().forEach(packedChunkPos -> { this.getAllChunksToSave().forEach(packedChunkPos -> {
boolean flag = this.chunkVisibility.get(packedChunkPos) == Visibility.HIDDEN; boolean flag = this.chunkVisibility.get(packedChunkPos) == Visibility.HIDDEN;
if (flag) { if (flag) {
@@ -267,6 +311,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -267,6 +_,7 @@
} }
public void saveAll() { public void saveAll() {
@@ -183,7 +175,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
LongSet allChunksToSave = this.getAllChunksToSave(); LongSet allChunksToSave = this.getAllChunksToSave();
while (!allChunksToSave.isEmpty()) { while (!allChunksToSave.isEmpty()) {
@@ -283,7 +328,13 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -283,7 +_,13 @@
@Override @Override
public void close() throws IOException { public void close() throws IOException {
@@ -198,7 +190,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
this.permanentStorage.close(); this.permanentStorage.close();
} }
@@ -384,6 +435,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -384,6 +_,7 @@
BlockPos blockPos = this.entity.blockPosition(); BlockPos blockPos = this.entity.blockPosition();
long packedSectionPos = SectionPos.asLong(blockPos); long packedSectionPos = SectionPos.asLong(blockPos);
if (packedSectionPos != this.currentSectionKey) { if (packedSectionPos != this.currentSectionKey) {
@@ -206,7 +198,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
Visibility status = this.currentSection.getStatus(); Visibility status = this.currentSection.getStatus();
if (!this.currentSection.remove(this.entity)) { if (!this.currentSection.remove(this.entity)) {
PersistentEntitySectionManager.LOGGER PersistentEntitySectionManager.LOGGER
@@ -431,6 +483,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -431,6 +_,7 @@
@Override @Override
public void onRemove(Entity.RemovalReason reason) { public void onRemove(Entity.RemovalReason reason) {