mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 04:02:06 -07:00
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:
@@ -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 -> {
|
@@ -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
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -67,8 +67,10 @@ public class Main {
|
||||
@@ -68,8 +_,10 @@
|
||||
reason = "System.out needed before bootstrap"
|
||||
)
|
||||
@DontObfuscate
|
||||
@@ -20,7 +12,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
OptionParser optionParser = new OptionParser();
|
||||
OptionSpec<Void> optionSpec = optionParser.accepts("nogui");
|
||||
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);
|
||||
return;
|
||||
}
|
||||
@@ -124,7 +116,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
Dynamic<?> dataTag;
|
||||
if (levelStorageAccess.hasWorldData()) {
|
||||
LevelSummary summary;
|
||||
@@ -169,12 +224,33 @@ public class Main {
|
||||
@@ -170,12 +_,33 @@
|
||||
}
|
||||
|
||||
Dynamic<?> dynamic = dataTag;
|
||||
@@ -159,7 +151,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
|
||||
WorldStem worldStem;
|
||||
try {
|
||||
@@ -183,6 +259,7 @@ public class Main {
|
||||
@@ -184,6 +_,7 @@
|
||||
executor -> WorldLoader.load(
|
||||
initConfig,
|
||||
context -> {
|
||||
@@ -167,7 +159,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
Registry<LevelStem> registry = context.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM);
|
||||
if (dynamic != null) {
|
||||
LevelDataAndDimensions levelDataAndDimensions = LevelStorageSource.getLevelDataAndDimensions(
|
||||
@@ -196,7 +273,7 @@ public class Main {
|
||||
@@ -197,7 +_,7 @@
|
||||
LevelSettings levelSettings;
|
||||
WorldOptions worldOptions;
|
||||
WorldDimensions worldDimensions;
|
||||
@@ -176,7 +168,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
levelSettings = MinecraftServer.DEMO_SETTINGS;
|
||||
worldOptions = WorldOptions.DEMO_OPTIONS;
|
||||
worldDimensions = WorldPresets.createNormalWorldDimensions(context.datapackWorldgen());
|
||||
@@ -211,7 +288,7 @@ public class Main {
|
||||
@@ -212,7 +_,7 @@
|
||||
new GameRules(context.dataConfiguration().enabledFeatures()),
|
||||
context.dataConfiguration()
|
||||
);
|
||||
@@ -185,7 +177,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
worldDimensions = properties.createDimensions(context.datapackWorldgen());
|
||||
}
|
||||
|
||||
@@ -237,6 +314,7 @@ public class Main {
|
||||
@@ -238,6 +_,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -193,7 +185,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
RegistryAccess.Frozen frozen = worldStem.registries().compositeAccess();
|
||||
WorldData worldData = worldStem.worldData();
|
||||
boolean hasOptionSpec1 = optionSet.has(optionSpec6);
|
||||
@@ -245,9 +323,13 @@ public class Main {
|
||||
@@ -246,9 +_,13 @@
|
||||
}
|
||||
|
||||
levelStorageAccess.saveDataTag(frozen, worldData);
|
||||
@@ -207,7 +199,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
thread1,
|
||||
levelStorageAccess,
|
||||
packRepository,
|
||||
@@ -257,17 +339,34 @@ public class Main {
|
||||
@@ -258,18 +_,36 @@
|
||||
services,
|
||||
LoggerChunkProgressListener::createFromGameruleRadius
|
||||
);
|
||||
@@ -229,14 +221,16 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
if (flag && !GraphicsEnvironment.isHeadless()) {
|
||||
dedicatedServer1.showGui();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ if (optionSet.has("port")) {
|
||||
+ int port = (Integer) optionSet.valueOf("port");
|
||||
+ if (port > 0) {
|
||||
+ dedicatedServer1.setPort(port);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Paper end
|
||||
|
||||
GameTestTicker.SINGLETON.startTicking();
|
||||
return dedicatedServer1;
|
||||
}
|
||||
);
|
||||
@@ -244,7 +238,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
Thread thread = new Thread("Server Shutdown Thread") {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -276,6 +375,7 @@ public class Main {
|
||||
@@ -278,6 +_,7 @@
|
||||
};
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
@@ -252,7 +246,7 @@ index 5cd0ef6d6dfab24420178cf238fcf4b0b2e6c14b..58be6e1d1607a3af5e28f851718b8232
|
||||
} catch (Exception 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,
|
||||
boolean recreateRegionFiles
|
||||
) {
|
@@ -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
|
||||
+++ b/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -47,7 +47,7 @@ import org.slf4j.Logger;
|
||||
@@ -47,7 +_,7 @@
|
||||
|
||||
public class PlayerAdvancements {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -17,7 +9,7 @@ index 9316688b6e7448c2f4805a399498e5562fa39f7c..52e0ae233a7b1c88bfbbc27707ef5f18
|
||||
private final PlayerList playerList;
|
||||
private final Path playerSavePath;
|
||||
private AdvancementTree tree;
|
||||
@@ -60,6 +60,7 @@ public class PlayerAdvancements {
|
||||
@@ -60,6 +_,7 @@
|
||||
private AdvancementHolder lastSelectedTab;
|
||||
private boolean isFirstPacket = true;
|
||||
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) {
|
||||
this.playerList = playerList;
|
||||
@@ -128,6 +129,7 @@ public class PlayerAdvancements {
|
||||
@@ -127,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void save() {
|
||||
@@ -33,7 +25,7 @@ index 9316688b6e7448c2f4805a399498e5562fa39f7c..52e0ae233a7b1c88bfbbc27707ef5f18
|
||||
JsonElement jsonElement = this.codec.encodeStart(JsonOps.INSTANCE, this.asData()).getOrThrow();
|
||||
|
||||
try {
|
||||
@@ -145,6 +147,7 @@ public class PlayerAdvancements {
|
||||
@@ -144,6 +_,7 @@
|
||||
data.forEach((path, progress) -> {
|
||||
AdvancementHolder advancementHolder = advancementManager.get(path);
|
||||
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);
|
||||
} else {
|
||||
this.startProgress(advancementHolder, progress);
|
||||
@@ -169,14 +172,31 @@ public class PlayerAdvancements {
|
||||
@@ -168,14 +_,31 @@
|
||||
AdvancementProgress orStartProgress = this.getOrStartProgress(advancement);
|
||||
boolean isDone = orStartProgress.isDone();
|
||||
if (orStartProgress.grantProgress(criterionKey)) {
|
||||
@@ -66,16 +58,16 @@ index 9316688b6e7448c2f4805a399498e5562fa39f7c..52e0ae233a7b1c88bfbbc27707ef5f18
|
||||
+ // Paper end
|
||||
advancement.value().rewards().grant(this.player);
|
||||
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);
|
||||
+ // 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);
|
||||
+ // Paper end
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -247,7 +267,7 @@ public class PlayerAdvancements {
|
||||
@@ -246,7 +_,7 @@
|
||||
public void flushDirty(ServerPlayer player, boolean showAdvancements) {
|
||||
if (this.isFirstPacket || !this.rootsToUpdate.isEmpty() || !this.progressChanged.isEmpty()) {
|
||||
Map<ResourceLocation, AdvancementProgress> map = new HashMap<>();
|
@@ -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
|
||||
+++ 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) {
|
||||
super.onScoreChanged(scoreHolder, objective, score);
|
||||
if (this.trackedObjectives.contains(objective)) {
|
||||
@@ -19,7 +11,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
new ClientboundSetScorePacket(
|
||||
scoreHolder.getScoreboardName(),
|
||||
objective.getName(),
|
||||
@@ -68,7 +66,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -70,7 +_,7 @@
|
||||
@Override
|
||||
public void onPlayerRemoved(ScoreHolder scoreHolder) {
|
||||
super.onPlayerRemoved(scoreHolder);
|
||||
@@ -28,7 +20,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -76,7 +74,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -78,7 +_,7 @@
|
||||
public void onPlayerScoreRemoved(ScoreHolder scoreHolder, Objective objective) {
|
||||
super.onPlayerScoreRemoved(scoreHolder, objective);
|
||||
if (this.trackedObjectives.contains(objective)) {
|
||||
@@ -37,7 +29,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
}
|
||||
|
||||
this.setDirty();
|
||||
@@ -88,7 +86,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -90,7 +_,7 @@
|
||||
super.setDisplayObjective(slot, objective);
|
||||
if (displayObjective != objective && displayObjective != null) {
|
||||
if (this.getObjectiveDisplaySlotCount(displayObjective) > 0) {
|
||||
@@ -46,7 +38,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
} else {
|
||||
this.stopTrackingObjective(displayObjective);
|
||||
}
|
||||
@@ -96,7 +94,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -98,7 +_,7 @@
|
||||
|
||||
if (objective != null) {
|
||||
if (this.trackedObjectives.contains(objective)) {
|
||||
@@ -55,7 +47,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
} else {
|
||||
this.startTrackingObjective(objective);
|
||||
}
|
||||
@@ -108,9 +106,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -110,9 +_,7 @@
|
||||
@Override
|
||||
public boolean addPlayerToTeam(String playerName, PlayerTeam team) {
|
||||
if (super.addPlayerToTeam(playerName, team)) {
|
||||
@@ -63,10 +55,10 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
- .getPlayerList()
|
||||
- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD));
|
||||
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD)); // CraftBukkit
|
||||
this.updatePlayerWaypoint(playerName);
|
||||
this.setDirty();
|
||||
return true;
|
||||
} else {
|
||||
@@ -118,15 +114,43 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -121,16 +_,44 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +88,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
- .getPlayerList()
|
||||
- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE));
|
||||
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(playerTeam, username, ClientboundSetPlayerTeamPacket.Action.REMOVE)); // CraftBukkit
|
||||
this.updatePlayerWaypoint(username);
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -113,7 +106,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
@Override
|
||||
public void onObjectiveAdded(Objective objective) {
|
||||
super.onObjectiveAdded(objective);
|
||||
@@ -137,7 +161,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -141,7 +_,7 @@
|
||||
public void onObjectiveChanged(Objective objective) {
|
||||
super.onObjectiveChanged(objective);
|
||||
if (this.trackedObjectives.contains(objective)) {
|
||||
@@ -122,7 +115,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
}
|
||||
|
||||
this.setDirty();
|
||||
@@ -156,21 +180,21 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -160,14 +_,14 @@
|
||||
@Override
|
||||
public void onTeamAdded(PlayerTeam playerTeam) {
|
||||
super.onTeamAdded(playerTeam);
|
||||
@@ -136,18 +129,19 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
super.onTeamChanged(playerTeam);
|
||||
- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, false));
|
||||
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(playerTeam, false)); // CraftBukkit
|
||||
this.updateTeamWaypoints(playerTeam);
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -175,7 +_,7 @@
|
||||
@Override
|
||||
public void onTeamRemoved(PlayerTeam playerTeam) {
|
||||
super.onTeamRemoved(playerTeam);
|
||||
- this.server.getPlayerList().broadcastAll(ClientboundSetPlayerTeamPacket.createRemovePacket(playerTeam));
|
||||
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createRemovePacket(playerTeam)); // CraftBukkit
|
||||
this.updateTeamWaypoints(playerTeam);
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -213,6 +237,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -219,6 +_,7 @@
|
||||
List<Packet<?>> startTrackingPackets = this.getStartTrackingPackets(objective);
|
||||
|
||||
for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
|
||||
@@ -155,7 +149,7 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
for (Packet<?> packet : startTrackingPackets) {
|
||||
serverPlayer.connection.send(packet);
|
||||
}
|
||||
@@ -238,6 +263,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -244,6 +_,7 @@
|
||||
List<Packet<?>> stopTrackingPackets = this.getStopTrackingPackets(objective);
|
||||
|
||||
for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
|
||||
@@ -163,10 +157,10 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
for (Packet<?> packet : stopTrackingPackets) {
|
||||
serverPlayer.connection.send(packet);
|
||||
}
|
||||
@@ -270,6 +296,16 @@ public class ServerScoreboard extends Scoreboard {
|
||||
return scoreboardSaveData;
|
||||
@@ -295,4 +_,13 @@
|
||||
.forEach(serverPlayer -> serverLevel.getWaypointManager().remakeConnections(serverPlayer));
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Send to players
|
||||
+ private void broadcastAll(Packet<?> packet) {
|
||||
+ for (ServerPlayer serverPlayer : this.server.getPlayerList().players) {
|
||||
@@ -176,7 +170,4 @@ index a485da44e599ccf22837dd912d2bb7e32c835661..9e22e93b1fab6822e0e9c1122024a889
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static enum Method {
|
||||
CHANGE,
|
||||
REMOVE;
|
||||
}
|
@@ -1145,6 +1145,16 @@
|
||||
}
|
||||
|
||||
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 @@
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
+++ 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)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -30,7 +22,7 @@ index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b
|
||||
ItemStack bodyArmorItem = this.getBodyArmorItem();
|
||||
int damageValue = bodyArmorItem.getDamageValue();
|
||||
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) {
|
||||
@@ -439,7 +442,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
||||
@@ -438,7 +_,7 @@
|
||||
protected void applyTamingSideEffects() {
|
||||
if (this.isTame()) {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(40.0);
|
||||
@@ -47,7 +39,7 @@ index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b
|
||||
} else {
|
||||
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);
|
||||
FoodProperties foodProperties = itemInHand.get(DataComponents.FOOD);
|
||||
float f = foodProperties != null ? foodProperties.nutrition() : 1.0F;
|
||||
@@ -56,26 +48,16 @@ index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -492,7 +495,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
- this.setTarget(null);
|
||||
+ this.setTarget(null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // CraftBukkit - reason
|
||||
return InteractionResult.SUCCESS.withoutItem();
|
||||
}
|
||||
|
||||
@@ -504,7 +507,9 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
||||
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
|
||||
@@ -492,7 +_,7 @@
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
- this.setTarget(null);
|
||||
+ this.setTarget(null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // CraftBukkit - reason
|
||||
return InteractionResult.SUCCESS.withoutItem();
|
||||
}
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -512,6 +517,13 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
||||
@@ -501,6 +_,13 @@
|
||||
|
||||
DyeColor dyeColor = dyeItem.getDyeColor();
|
||||
if (dyeColor != this.getCollarColor()) {
|
||||
@@ -89,7 +71,7 @@ index 6b00988dafe9e2ac32e543623a4a1942a0c78a76..d926ecd041ca2a421057bc22efe66a8b
|
||||
this.setCollarColor(dyeColor);
|
||||
itemInHand.consume(1, player);
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -526,7 +538,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
||||
@@ -515,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void tryToTame(Player player) {
|
@@ -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
|
||||
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -69,6 +69,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -72,6 +_,7 @@
|
||||
public CompoundTag blockData;
|
||||
public boolean forceTickAfterTeleportToDuplicate;
|
||||
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) {
|
||||
super(entityType, level);
|
||||
@@ -94,6 +95,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -97,6 +_,7 @@
|
||||
pos.getZ() + 0.5,
|
||||
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.addFreshEntity(fallingBlockEntity);
|
||||
return fallingBlockEntity;
|
||||
@@ -144,13 +146,22 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -147,13 +_,22 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.blockState.isAir()) {
|
||||
@@ -48,7 +40,7 @@ index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf3
|
||||
this.handlePortal();
|
||||
if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) {
|
||||
BlockPos blockPos = this.blockPosition();
|
||||
@@ -171,12 +182,12 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -174,12 +_,12 @@
|
||||
}
|
||||
|
||||
if (!this.onGround() && !flag1) {
|
||||
@@ -63,7 +55,7 @@ index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf3
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -83,7 +75,7 @@ index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf3
|
||||
if (block instanceof Fallable) {
|
||||
((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)) {
|
||||
@@ -106,26 +98,26 @@ index 735e8bcfdc4380f37da1fb95955a190868858f7c..31edd0d45ac6c38887e4cebffe5a7cf3
|
||||
this.callOnBrokenAfterFall(block, blockPos);
|
||||
}
|
||||
}
|
||||
@@ -293,6 +310,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -299,6 +_,7 @@
|
||||
}
|
||||
|
||||
compound.putBoolean("CancelDrop", this.cancelDrop);
|
||||
+ if (!this.autoExpire) compound.putBoolean("Paper.AutoExpire", false); // Paper - Expand FallingBlock API
|
||||
output.putBoolean("CancelDrop", this.cancelDrop);
|
||||
+ if (!this.autoExpire) output.putBoolean("Paper.AutoExpire", false); // Paper - Expand FallingBlock API
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -305,8 +323,9 @@ public class FallingBlockEntity extends Entity {
|
||||
this.fallDamagePerDistance = compound.getFloatOr("FallHurtAmount", 0.0F);
|
||||
this.fallDamageMax = compound.getIntOr("FallHurtMax", 40);
|
||||
this.dropItem = compound.getBooleanOr("DropItem", true);
|
||||
- this.blockData = compound.getCompound("TileEntityData").map(CompoundTag::copy).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.cancelDrop = compound.getBooleanOr("CancelDrop", false);
|
||||
+ this.autoExpire = compound.getBooleanOr("Paper.AutoExpire", true); // Paper - Expand FallingBlock API
|
||||
@@ -310,8 +_,9 @@
|
||||
this.fallDamagePerDistance = input.getFloatOr("FallHurtAmount", 0.0F);
|
||||
this.fallDamageMax = input.getIntOr("FallHurtMax", 40);
|
||||
this.dropItem = input.getBooleanOr("DropItem", true);
|
||||
- this.blockData = input.read("TileEntityData", CompoundTag.CODEC).orElse(null);
|
||||
+ 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 = input.getBooleanOr("CancelDrop", false);
|
||||
+ this.autoExpire = input.getBooleanOr("Paper.AutoExpire", true); // Paper - Expand FallingBlock API
|
||||
}
|
||||
|
||||
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();
|
||||
boolean flag = (resourceKey1 == Level.END || resourceKey == Level.END) && resourceKey1 != resourceKey;
|
||||
Entity entity = super.teleport(teleportTransition);
|
@@ -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
|
||||
+++ b/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -56,6 +56,9 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -53,6 +_,9 @@
|
||||
@Nullable
|
||||
public UUID target;
|
||||
public final float bobOffs;
|
||||
@@ -18,7 +10,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
|
||||
|
||||
public ItemEntity(EntityType<? extends ItemEntity> entityType, Level 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) {
|
||||
@@ -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) {
|
||||
@@ -126,7 +134,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -116,7 +_,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.getItem().isEmpty()) {
|
||||
@@ -41,7 +33,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
|
||||
} else {
|
||||
super.tick();
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
if (this.isMergable()) {
|
||||
@@ -96,7 +88,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
|
||||
this.tryToMerge(itemEntity);
|
||||
if (this.isRemoved()) {
|
||||
break;
|
||||
@@ -231,7 +258,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -221,7 +_,7 @@
|
||||
|
||||
private boolean isMergable() {
|
||||
ItemStack item = this.getItem();
|
||||
@@ -105,7 +97,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -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)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -142,25 +134,24 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -324,6 +361,11 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
|
||||
compound.store("Item", ItemStack.CODEC, registryOps, this.getItem());
|
||||
@@ -313,6 +_,11 @@
|
||||
if (!this.getItem().isEmpty()) {
|
||||
output.store("Item", ItemStack.CODEC, this.getItem());
|
||||
}
|
||||
+ // Paper start - Friction API
|
||||
+ 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
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -336,8 +378,19 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
this.cachedThrower = null;
|
||||
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
|
||||
this.setItem(compound.read("Item", ItemStack.CODEC, registryOps).orElse(ItemStack.EMPTY));
|
||||
+
|
||||
@@ -323,8 +_,17 @@
|
||||
this.target = input.read("Owner", UUIDUtil.CODEC).orElse(null);
|
||||
this.thrower = EntityReference.read(input, "Thrower");
|
||||
this.setItem(input.read("Item", ItemStack.CODEC).orElse(ItemStack.EMPTY));
|
||||
+ // Paper start - Friction API
|
||||
+ compound.getString("Paper.FrictionState").ifPresent(frictionState -> {
|
||||
+ input.getString("Paper.FrictionState").ifPresent(frictionState -> {
|
||||
+ try {
|
||||
+ this.frictionState = net.kyori.adventure.util.TriState.valueOf(frictionState);
|
||||
+ } catch (Exception ignored) {
|
||||
@@ -168,14 +159,13 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
|
||||
+ }
|
||||
+ });
|
||||
+ // Paper end - Friction API
|
||||
+
|
||||
if (this.getItem().isEmpty()) {
|
||||
- this.discard();
|
||||
+ 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();
|
||||
Item item1 = item.getItem();
|
||||
int count = item.getCount();
|
||||
@@ -250,7 +240,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
|
||||
item.setCount(count);
|
||||
}
|
||||
|
||||
@@ -388,6 +504,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -375,6 +_,7 @@
|
||||
|
||||
public void setItem(ItemStack stack) {
|
||||
this.getEntityData().set(DATA_ITEM, stack);
|
||||
@@ -258,7 +248,7 @@ index dd6d590d5cb0e63e1bb8e135c79d2747635c61e7..ea3afc27600cde05a17197b071f14972
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -441,7 +558,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -427,7 +_,7 @@
|
||||
|
||||
public void makeFakeItem() {
|
||||
this.setNeverPickUp();
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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
|
||||
+++ 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);
|
||||
}
|
||||
|
||||
@@ -25,7 +17,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
void removeSectionIfEmpty(long sectionKey, EntitySection<T> section) {
|
||||
if (section.isEmpty()) {
|
||||
this.sectionStorage.remove(sectionKey);
|
||||
@@ -59,6 +69,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -59,6 +_,7 @@
|
||||
}
|
||||
|
||||
private boolean addEntityUuid(T entity) {
|
||||
@@ -33,7 +25,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
if (!this.knownUuids.add(entity.getUUID())) {
|
||||
LOGGER.warn("UUID of added entity already exists: {}", entity);
|
||||
return false;
|
||||
@@ -72,6 +83,17 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -72,6 +_,17 @@
|
||||
}
|
||||
|
||||
private boolean addEntity(T entity, boolean worldGenSpawned) {
|
||||
@@ -51,7 +43,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
if (!this.addEntityUuid(entity)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -113,19 +135,23 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -113,19 +_,23 @@
|
||||
}
|
||||
|
||||
void startTicking(T entity) {
|
||||
@@ -75,7 +67,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
this.callbacks.onTrackingEnd(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) {
|
||||
@@ -83,7 +75,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
long packedChunkPos = pos.toLong();
|
||||
if (visibility == Visibility.HIDDEN) {
|
||||
this.chunkVisibility.remove(packedChunkPos);
|
||||
@@ -169,6 +196,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -169,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void ensureChunkQueuedForLoad(long chunkPosValue) {
|
||||
@@ -91,7 +83,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue);
|
||||
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.FRESH) {
|
||||
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) {
|
||||
@@ -103,7 +95,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPosValue);
|
||||
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.PENDING) {
|
||||
return false;
|
||||
@@ -186,6 +219,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -186,6 +_,7 @@
|
||||
.collect(Collectors.toList());
|
||||
if (list.isEmpty()) {
|
||||
if (chunkLoadStatus == PersistentEntitySectionManager.ChunkLoadStatus.LOADED) {
|
||||
@@ -111,7 +103,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
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);
|
||||
return false;
|
||||
} else {
|
||||
@@ -119,7 +111,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
this.permanentStorage.storeEntities(new ChunkEntities<>(new ChunkPos(chunkPosValue), list));
|
||||
list.forEach(entityAction);
|
||||
return true;
|
||||
@@ -202,6 +237,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -202,6 +_,7 @@
|
||||
}
|
||||
|
||||
private void requestChunkLoad(long chunkPosValue) {
|
||||
@@ -127,7 +119,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
this.chunkLoadStatuses.put(chunkPosValue, PersistentEntitySectionManager.ChunkLoadStatus.PENDING);
|
||||
ChunkPos chunkPos = new ChunkPos(chunkPosValue);
|
||||
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) {
|
||||
@@ -137,7 +129,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
if (!flag) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -221,7 +258,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -221,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void unloadEntity(EntityAccess entity) {
|
||||
@@ -146,10 +138,10 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
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
|
||||
ChunkEntities<T> chunkEntities;
|
||||
while ((chunkEntities = this.loadingInbox.poll()) != null) {
|
||||
@@ -167,7 +159,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
this.processPendingLoads();
|
||||
this.processUnloads();
|
||||
}
|
||||
@@ -256,6 +299,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -256,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void autoSave() {
|
||||
@@ -175,7 +167,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
this.getAllChunksToSave().forEach(packedChunkPos -> {
|
||||
boolean flag = this.chunkVisibility.get(packedChunkPos) == Visibility.HIDDEN;
|
||||
if (flag) {
|
||||
@@ -267,6 +311,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -267,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void saveAll() {
|
||||
@@ -183,7 +175,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
LongSet allChunksToSave = this.getAllChunksToSave();
|
||||
|
||||
while (!allChunksToSave.isEmpty()) {
|
||||
@@ -283,7 +328,13 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -283,7 +_,13 @@
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
@@ -198,7 +190,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
this.permanentStorage.close();
|
||||
}
|
||||
|
||||
@@ -384,6 +435,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -384,6 +_,7 @@
|
||||
BlockPos blockPos = this.entity.blockPosition();
|
||||
long packedSectionPos = SectionPos.asLong(blockPos);
|
||||
if (packedSectionPos != this.currentSectionKey) {
|
||||
@@ -206,7 +198,7 @@ index 54c2093b114661834d9cc856be16439bec8bb7a0..3d9af34c6eb4ac4fb07ccd8709066cc5
|
||||
Visibility status = this.currentSection.getStatus();
|
||||
if (!this.currentSection.remove(this.entity)) {
|
||||
PersistentEntitySectionManager.LOGGER
|
||||
@@ -431,6 +483,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
@@ -431,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void onRemove(Entity.RemovalReason reason) {
|
Reference in New Issue
Block a user