[ci skip] Add more identifying patch comments

This commit is contained in:
Nassim Jahnke 2024-01-20 23:13:41 +01:00
parent b48d737759
commit 8d94596e30
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
49 changed files with 226 additions and 229 deletions

View File

@ -90,7 +90,7 @@ index 5e20dba0d011d20b714d784cb4a545a05bbf6f9c..5a21205a49606b294de4cd27b60438c6
if (!flag && flag1) {
- consumer.accept(voxelshape1);
- return true;
+ collisions.add(voxelshape1);// Paper
+ collisions.add(voxelshape1); // Paper
+ if (returnFast) return collisions;
}
}

View File

@ -45,7 +45,7 @@ index 79f2b3942a3ccccd8fe8719db12de458212e8659..d113b4835e86a789c0ba124eb839e1c5
- });
+ object = new LevelChunk(world.getLevel(), pos, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, k, achunksection, // Paper start - fix massive nbt memory leak due to lambda. move lambda into a container method to not leak scope. Only clone needed NBT keys.
+ createLoadEntitiesConsumer(new SafeNBTCopy(nbttagcompound1, "TileEntities", "Entities", "ChunkBukkitValues")) // Paper - move CB Chunk PDC into here
+ );// Paper end
+ ); // Paper end
} else {
ProtoChunk protochunk = new ProtoChunk(pos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, world); // Paper - add level

View File

@ -216,7 +216,7 @@ index 81701abd11fbc4671393a76a42973f53835ca234..e8cf0088e94925934acd02ba05b9411b
if (this.data == null) {
- this.data = new byte[2048];
+ this.data = BYTE_2048.acquire(); // Paper
+ registerCleaner();// Paper
+ registerCleaner(); // Paper
}
int k = DataLayer.getByteIndex(index);

View File

@ -2273,7 +2273,7 @@ index 4dd3af1416cbdad330365a19ad664079f3598c15..45db9f1b1d19319e7f92bd4e61be9ea9
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
*/
+ Class.forName(net.minecraft.world.entity.npc.VillagerTrades.class.getName());// Paper - load this sync so it won't fail later async
+ Class.forName(net.minecraft.world.entity.npc.VillagerTrades.class.getName()); // Paper - load this sync so it won't fail later async
final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.spin((thread) -> {
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, config.get(), ops.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::new);

View File

@ -180,7 +180,7 @@ index 4b24e4d947e96ea0720f8f6bc33470e07c00310d..d60173b03baee4a66da1109795bf6a19
this.queueSorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(threadedmailbox, mailbox, threadedmailbox1), executor, Integer.MAX_VALUE);
this.worldgenMailbox = this.queueSorter.getProcessor(threadedmailbox, false);
this.mainThreadMailbox = this.queueSorter.getProcessor(mailbox, false);
+ this.mailboxLight = this.queueSorter.getProcessor(lightthreaded, false);// Paper
+ this.mailboxLight = this.queueSorter.getProcessor(lightthreaded, false); // Paper
this.lightEngine = new ThreadedLevelLightEngine(chunkProvider, this, this.level.dimensionType().hasSkyLight(), threadedmailbox1, this.queueSorter.getProcessor(threadedmailbox1, false));
this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor);
this.overworldDataStorage = persistentStateManagerFactory;

View File

@ -712,7 +712,7 @@ index daedf825e68655492f5ab776bc206a5eb87c0170..7de24c39b460e43d27839b3821e67213
} catch (Exception exception) {
label25:
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3691fd58c7baf98b15c50fa4dacf3a35f4f9b4b8..069af49a03e0d313499f8d1815c8299ec034de61 100644
index 3691fd58c7baf98b15c50fa4dacf3a35f4f9b4b8..a6a8b5079ceaad90a79a09cab5c38a6fde6d33ee 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -186,7 +186,7 @@ import org.bukkit.craftbukkit.Main;
@ -736,7 +736,7 @@ index 3691fd58c7baf98b15c50fa4dacf3a35f4f9b4b8..069af49a03e0d313499f8d1815c8299e
private boolean haveTime() {
// CraftBukkit start
+ if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken
+ if (isOversleep) return canOversleep(); // Paper - because of our changes, this logic is broken
return this.forceTicks || this.runningTask() || Util.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
}

View File

@ -16644,19 +16644,19 @@ index a5e438a834826161c52ca9db57d234d9ff80a591..b8bc1b9b8e8a33df90a963f9f9769292
@Override
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index ba58580f4c60205d1c7a7b7dfcdc22c4fafc9bc6..9d32d03ad59a6e2dfef2c157e621f9ef43098534 100644
index ba58580f4c60205d1c7a7b7dfcdc22c4fafc9bc6..9ead836c08ff48430bc6d3ba225864f48d335eee 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -305,6 +305,7 @@ public class Main {
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
*/
+ Class.forName(net.minecraft.world.entity.npc.VillagerTrades.class.getName());// Paper - load this sync so it won't fail later async
+ Class.forName(net.minecraft.world.entity.npc.VillagerTrades.class.getName()); // Paper - load this sync so it won't fail later async
final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.spin((thread) -> {
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::new);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 069af49a03e0d313499f8d1815c8299ec034de61..cfab6bdf3c3eaf456b60653377df05fcf74c53e3 100644
index a6a8b5079ceaad90a79a09cab5c38a6fde6d33ee..75b39c8a8471bc37add3a012453c74217357535a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -300,7 +300,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -16793,7 +16793,7 @@ index 069af49a03e0d313499f8d1815c8299ec034de61..cfab6bdf3c3eaf456b60653377df05fc
+ }
+ // Paper end
// CraftBukkit start
if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken
if (isOversleep) return canOversleep(); // Paper - because of our changes, this logic is broken
return this.forceTicks || this.runningTask() || Util.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
@@ -2344,7 +2338,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
@ -18646,7 +18646,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
@Nullable
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
index 0bd05d7a8f2a388c28ddcf3f07db5b0648dddeea..b01006ade4750f60ceba951812bbc6e2ca04bf9c 100644
index 0bd05d7a8f2a388c28ddcf3f07db5b0648dddeea..36686a92bd7dc0e29049f72c0e953ff56c2645eb 100644
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
@@ -39,67 +39,29 @@ import org.slf4j.Logger;
@ -18953,7 +18953,7 @@ index 0bd05d7a8f2a388c28ddcf3f07db5b0648dddeea..b01006ade4750f60ceba951812bbc6e2
protected void updatePlayerTickets(int viewDistance) {
- this.playerTicketManager.updateViewDistance(viewDistance);
+ this.chunkMap.setServerViewDistance(viewDistance);// Paper - route to player chunk manager
+ this.chunkMap.setServerViewDistance(viewDistance); // Paper - route to player chunk manager
}
// Paper start

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Keep Spawn Loaded range per world
This lets you disable it for some worlds and lower it for others.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cdff8dfc675328e559b7063c67dfe6300f458eb6..6024a9e0dca38b1c21332f5c131d824190a2be90 100644
index f317b9fdb2bfbae9babd64d4801f190042fc1867..6407af497c719d0f6a4446192bed622af34d6bc6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -768,30 +768,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -166,7 +166,7 @@ index 1b565b2809c2d367e21971c5154f35c9763995e6..b0f899835ded29aff108d1674bf4a1a6
+ void setChunkRadius(int radius); // Paper - allow changing chunk radius
}
diff --git a/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java b/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java
index 4d2348df25410a0b5364eec066880326d6667dad..286aad3205ef8a9e21a47ef07893844fe857556a 100644
index 4d2348df25410a0b5364eec066880326d6667dad..b9176ec634ed806dda6ce84b8978803111462428 100644
--- a/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java
+++ b/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java
@@ -11,12 +11,19 @@ import org.slf4j.Logger;
@ -174,7 +174,7 @@ index 4d2348df25410a0b5364eec066880326d6667dad..286aad3205ef8a9e21a47ef07893844f
public class LoggerChunkProgressListener implements ChunkProgressListener {
private static final Logger LOGGER = LogUtils.getLogger();
- private final int maxCount;
+ private int maxCount;// Paper - remove final
+ private int maxCount; // Paper - remove final
private int count;
private long startTime;
private long nextTickTime = Long.MAX_VALUE;

View File

@ -1,8 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 12 Jun 2020 16:51:39 -0700
Subject: [PATCH] Prevent position desync in playerconnection causing tp
exploit
Subject: [PATCH] Prevent position desync causing tp exploit
Caused the server to revert to the player's overworld coordinates
after teleporting into the end.

View File

@ -1,18 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Fri, 5 Jun 2020 18:24:06 -0400
Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
Subject: [PATCH] Add PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b0f546190f4e5985e2532bb3647856ebc5efb92f..ab167cbce4e8c3ee4d755b778bd7b92a8be917de 100644
index b0f546190f4e5985e2532bb3647856ebc5efb92f..85392f2bc3e51aa03385ffaead73baec2580771b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2973,16 +2973,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!this.player.containerMenu.stillValid(this.player)) {
ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
} else {
+ // Paper start
+ // Paper start - Add PlayerRecipeBookClickEvent
+ ResourceLocation recipeName = packet.getRecipe();
+ boolean makeAll = packet.isShiftDown();
+ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent paperEvent = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent(
@ -24,7 +24,7 @@ index b0f546190f4e5985e2532bb3647856ebc5efb92f..ab167cbce4e8c3ee4d755b778bd7b92a
+ recipeName = CraftNamespacedKey.toMinecraft(paperEvent.getRecipe());
+ makeAll = paperEvent.isMakeAll();
+ if (org.bukkit.event.player.PlayerRecipeBookClickEvent.getHandlerList().getRegisteredListeners().length > 0) {
+ // Paper end
+ // Paper end - Add PlayerRecipeBookClickEvent
// CraftBukkit start - implement PlayerRecipeBookClickEvent
- org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(CraftNamespacedKey.fromMinecraft(packet.getRecipe()));
+ org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(CraftNamespacedKey.fromMinecraft(recipeName)); // Paper
@ -32,7 +32,7 @@ index b0f546190f4e5985e2532bb3647856ebc5efb92f..ab167cbce4e8c3ee4d755b778bd7b92a
return;
}
- org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, packet.isShiftDown());
+ // Paper start
+ // Paper start - Add PlayerRecipeBookClickEvent
+ org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, makeAll);
+ recipeName = CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey());
+ makeAll = event.isShiftClick();
@ -40,16 +40,16 @@ index b0f546190f4e5985e2532bb3647856ebc5efb92f..ab167cbce4e8c3ee4d755b778bd7b92a
+ if (!(this.player.containerMenu instanceof RecipeBookMenu<?> recipeBookMenu)) {
+ return;
+ }
+ // Paper end
+ // Paper end - Add PlayerRecipeBookClickEvent
// Cast to keyed should be safe as the recipe will never be a MerchantRecipe.
- this.server.getRecipeManager().byKey(CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey())).ifPresent((recipeholder) -> {
- ((RecipeBookMenu) this.player.containerMenu).handlePlacement(event.isShiftClick(), recipeholder, this.player);
+ // Paper start
+ // Paper start - Add PlayerRecipeBookClickEvent
+ final boolean finalMakeAll = makeAll;
+ this.server.getRecipeManager().byKey(recipeName).ifPresent((recipeholder) -> {
+ recipeBookMenu.handlePlacement(finalMakeAll, recipeholder, this.player);
+ // Paper end
+ // Paper end - Add PlayerRecipeBookClickEvent
});
// CraftBukkit end
}

View File

@ -9,7 +9,7 @@ on harddrives.
-DPaper.enable-sync-chunk-writes=true to enable
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index 7edce6f8d1f313a9e1e100704d625e317f779fa0..1643186bcb2caf5d29fd551afd35830726dbb80a 100644
index 7edce6f8d1f313a9e1e100704d625e317f779fa0..c58d03898edc49b4451c82d4ccdb86980bc1a40a 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -144,7 +144,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@ -17,7 +17,7 @@ index 7edce6f8d1f313a9e1e100704d625e317f779fa0..1643186bcb2caf5d29fd551afd358307
return Mth.clamp(integer, 1, 29999984);
}, 29999984);
- this.syncChunkWrites = this.get("sync-chunk-writes", true);
+ this.syncChunkWrites = this.get("sync-chunk-writes", true) && Boolean.getBoolean("Paper.enable-sync-chunk-writes"); // Paper - hide behind flag
+ this.syncChunkWrites = this.get("sync-chunk-writes", true) && Boolean.getBoolean("Paper.enable-sync-chunk-writes"); // Paper - Hide sync chunk writes behind flag
this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false);
this.enableStatus = this.get("enable-status", true);
this.hideOnlinePlayers = this.get("hide-online-players", false);

View File

@ -8,7 +8,7 @@ makes it so that the server keeps the last difficulty used instead
of restoring the server.properties every single load.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 728858a2a52bd23c7b42d0e7340abf5f09d24fc5..8a037e12ba9419ec29c62799e30312c50b7ee4ad 100644
index 739e6cf058f2d85c874d1c4f114963035b8c645f..6ffb81f09e7422adeb29f0651a9d3b6e7f6860d3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -828,7 +828,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -29,14 +29,14 @@ index 728858a2a52bd23c7b42d0e7340abf5f09d24fc5..8a037e12ba9419ec29c62799e30312c5
- this.worldData.setDifficulty(this.worldData.isHardcore() ? Difficulty.HARD : difficulty);
- this.updateMobSpawningFlags();
- this.getPlayerList().getPlayers().forEach(this::sendDifficultyUpdate);
+ // Paper start - remember per level difficulty
+ // Paper start - per level difficulty
+ public void setDifficulty(ServerLevel level, Difficulty difficulty, boolean forceUpdate) {
+ PrimaryLevelData worldData = level.serverLevelData;
+ if (forceUpdate || !worldData.isDifficultyLocked()) {
+ worldData.setDifficulty(worldData.isHardcore() ? Difficulty.HARD : difficulty);
+ level.setSpawnSettings(worldData.getDifficulty() != Difficulty.PEACEFUL && ((DedicatedServer) this).settings.getProperties().spawnMonsters, this.isSpawningAnimals());
+ // this.getPlayerList().getPlayers().forEach(this::sendDifficultyUpdate);
+ // Paper end
+ // Paper end - per level difficulty
}
}
@ -50,7 +50,7 @@ index 728858a2a52bd23c7b42d0e7340abf5f09d24fc5..8a037e12ba9419ec29c62799e30312c5
}
diff --git a/src/main/java/net/minecraft/server/commands/DifficultyCommand.java b/src/main/java/net/minecraft/server/commands/DifficultyCommand.java
index 997a96a21440ae72696d68f8031ece4ba487d3ef..d0f851ca4d91791da26902d7d516b0fdace8cc95 100644
index 997a96a21440ae72696d68f8031ece4ba487d3ef..3d8584929cee000ae7df10c5bd94f35820e70294 100644
--- a/src/main/java/net/minecraft/server/commands/DifficultyCommand.java
+++ b/src/main/java/net/minecraft/server/commands/DifficultyCommand.java
@@ -49,7 +49,7 @@ public class DifficultyCommand {
@ -58,12 +58,12 @@ index 997a96a21440ae72696d68f8031ece4ba487d3ef..d0f851ca4d91791da26902d7d516b0fd
throw DifficultyCommand.ERROR_ALREADY_DIFFICULT.create(difficulty.getKey());
} else {
- worldServer.serverLevelData.setDifficulty(difficulty); // CraftBukkit
+ minecraftserver.setDifficulty(worldServer, difficulty, true); // Paper - don't skip other difficulty-changing logic (fix upstream's fix)
+ minecraftserver.setDifficulty(worldServer, difficulty, true); // Paper - per level difficulty; don't skip other difficulty-changing logic (fix upstream's fix)
source.sendSuccess(() -> {
return Component.translatable("commands.difficulty.success", difficulty.getDisplayName());
}, true);
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 684e9e9d78f0d410176fa8b9c9d0fbfda6a156dc..2d5e8d624b153f55e28d8a4e008dce11853179cf 100644
index 684e9e9d78f0d410176fa8b9c9d0fbfda6a156dc..6c009f7443eabce73ace587a9fc686c320f707a7 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -325,7 +325,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -71,12 +71,12 @@ index 684e9e9d78f0d410176fa8b9c9d0fbfda6a156dc..2d5e8d624b153f55e28d8a4e008dce11
@Override
public void forceDifficulty() {
- this.setDifficulty(this.getProperties().difficulty, true);
+ // this.setDifficulty(this.getProperties().difficulty, true); // Paper - Don't overwrite level.dat's difficulty, keep current
+ // this.setDifficulty(this.getProperties().difficulty, true); // Paper - per level difficulty; Don't overwrite level.dat's difficulty, keep current
}
@Override
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 71068a285ff039b609f4551d522481f2dff8235e..d43bf7ff39e9424f5cdcc93d29779570c8735869 100644
index 71068a285ff039b609f4551d522481f2dff8235e..da445644b1f2de9f80e8198a8ed150103627187b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1209,7 +1209,7 @@ public class ServerPlayer extends Player {
@ -84,12 +84,12 @@ index 71068a285ff039b609f4551d522481f2dff8235e..d43bf7ff39e9424f5cdcc93d29779570
this.connection.send(new ClientboundRespawnPacket(this.createCommonSpawnInfo(worldserver), (byte) 3));
- this.connection.send(new ClientboundChangeDifficultyPacket(this.level().getDifficulty(), this.level().getLevelData().isDifficultyLocked()));
+ this.connection.send(new ClientboundChangeDifficultyPacket(worldserver.getDifficulty(), this.level().getLevelData().isDifficultyLocked())); // Paper - fix difficulty sync issue
+ this.connection.send(new ClientboundChangeDifficultyPacket(worldserver.getDifficulty(), this.level().getLevelData().isDifficultyLocked())); // Paper - per level difficulty
PlayerList playerlist = this.server.getPlayerList();
playerlist.sendPlayerPermissionLevel(this);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 448cbe86cefdf779c7faae84748e04374f16162d..101871664077577c5cbe159d5d1a31b0e30ec68d 100644
index ea0628515793f9a4aad5d41def90eb3034a81680..de8c48f6d3ab7eb15e934b323986ea1120ac585a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3176,7 +3176,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -97,7 +97,7 @@ index 448cbe86cefdf779c7faae84748e04374f16162d..101871664077577c5cbe159d5d1a31b0
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {
- this.server.setDifficulty(packet.getDifficulty(), false);
+ // this.server.setDifficulty(packet.getDifficulty(), false); // Paper - don't allow clients to change this
+ // this.server.setDifficulty(packet.getDifficulty(), false); // Paper - per level difficulty; don't allow clients to change this
}
}
@ -117,7 +117,7 @@ index 33894e96a54039d5b406c552d8a5db6e17037151..4bb4df79dbe65fd5a6f53df64890eaa5
for (SpawnCategory spawnCategory : SpawnCategory.values()) {
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 357b82e110b789b7a12735a844a9c7e720b4f479..cb053e6c8f3cc1346a679354696e0fa0b6d3a150 100644
index 357b82e110b789b7a12735a844a9c7e720b4f479..664389b1f37acee12cdd4bdd6fc0b9d3e6f568fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1158,7 +1158,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -125,7 +125,7 @@ index 357b82e110b789b7a12735a844a9c7e720b4f479..cb053e6c8f3cc1346a679354696e0fa0
@Override
public void setDifficulty(Difficulty difficulty) {
- this.getHandle().serverLevelData.setDifficulty(net.minecraft.world.Difficulty.byId(difficulty.getValue()));
+ this.getHandle().getServer().setDifficulty(this.getHandle(), net.minecraft.world.Difficulty.byId(difficulty.getValue()), true); // Paper - don't skip other difficulty-changing logic
+ this.getHandle().getServer().setDifficulty(this.getHandle(), net.minecraft.world.Difficulty.byId(difficulty.getValue()), true); // Paper - per level difficulty; don't skip other difficulty-changing logic
}
@Override

View File

@ -7,14 +7,14 @@ Don't constantly send format: false for all formatting options when parent alrea
has it false
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
index 516b3fef4d388366df09f0dd88deadbcc0b7d344..730d8e3cf2d9ca05b2d6219cf1856b8721871a37 100644
index 516b3fef4d388366df09f0dd88deadbcc0b7d344..753200057e74b8e2d5274894b982e6ee946a559e 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
@@ -46,6 +46,7 @@ public final class CraftChatMessage {
// Separate pattern with no group 3, new lines are part of previous string
private static final Pattern INCREMENTAL_PATTERN_KEEP_NEWLINES = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " ]|$))))", Pattern.CASE_INSENSITIVE);
// ChatColor.b does not explicitly reset, its more of empty
+ private static final Style EMPTY = Style.EMPTY.withItalic(false); // Paper - OBFHELPER
+ private static final Style EMPTY = Style.EMPTY.withItalic(false); // Paper - Improve Legacy Component serialization size
private static final Style RESET = Style.EMPTY.withBold(false).withItalic(false).withUnderlined(false).withStrikethrough(false).withObfuscated(false);
private final List<Component> list = new ArrayList<Component>();
@ -22,7 +22,7 @@ index 516b3fef4d388366df09f0dd88deadbcc0b7d344..730d8e3cf2d9ca05b2d6219cf1856b87
Matcher matcher = (keepNewlines ? StringMessage.INCREMENTAL_PATTERN_KEEP_NEWLINES : StringMessage.INCREMENTAL_PATTERN).matcher(message);
String match = null;
boolean needsAdd = false;
+ boolean hasReset = false; // Paper
+ boolean hasReset = false; // Paper - Improve Legacy Component serialization size
while (matcher.find()) {
int groupId = 0;
while ((match = matcher.group(++groupId)) == null) {
@ -31,7 +31,7 @@ index 516b3fef4d388366df09f0dd88deadbcc0b7d344..730d8e3cf2d9ca05b2d6219cf1856b87
}
} else { // Color resets formatting
- this.modifier = StringMessage.RESET.withColor(format);
+ // Paper start - improve legacy formatting
+ // Paper start - Improve Legacy Component serialization size
+ Style previous = modifier;
+ modifier = (!hasReset ? RESET : EMPTY).withColor(format);
+ hasReset = true;
@ -50,7 +50,7 @@ index 516b3fef4d388366df09f0dd88deadbcc0b7d344..730d8e3cf2d9ca05b2d6219cf1856b87
+ if (previous.isUnderlined()) {
+ modifier = modifier.withUnderlined(false);
+ }
+ // Paper end
+ // Paper end - Improve Legacy Component serialization size
}
needsAdd = true;
break;

View File

@ -7,7 +7,7 @@ Inline bit operations and reduce instruction count to make these hot
operations faster
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index e039551efc83af1453a115099b78e16dff2cf190..e5dfc4009cb06e500c6b54ee4228117061758b53 100644
index ef5f897164136767e9c6dd61b76c2a1dedd4f350..46aeeaade74bde10472e209df61a75adc4461eeb 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -37,15 +37,16 @@ public class BlockPos extends Vec3i {
@ -23,7 +23,7 @@ index e039551efc83af1453a115099b78e16dff2cf190..e5dfc4009cb06e500c6b54ee42281170
- private static final int Y_OFFSET = 0;
- private static final int Z_OFFSET = PACKED_Y_LENGTH;
- private static final int X_OFFSET = PACKED_Y_LENGTH + PACKED_Z_LENGTH;
+ // Paper start - static constants
+ // Paper start - Optimize Bit Operations by inlining
+ private static final int PACKED_X_LENGTH = 26;
+ private static final int PACKED_Z_LENGTH = 26;
+ public static final int PACKED_Y_LENGTH = 12;
@ -32,7 +32,7 @@ index e039551efc83af1453a115099b78e16dff2cf190..e5dfc4009cb06e500c6b54ee42281170
+ private static final long PACKED_Z_MASK = 67108863;
+ private static final int Z_OFFSET = 12;
+ private static final int X_OFFSET = 38;
+ // Paper end
+ // Paper end - Optimize Bit Operations by inlining
public BlockPos(int x, int y, int z) {
super(x, y, z);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] incremental chunk and player saving
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8a037e12ba9419ec29c62799e30312c50b7ee4ad..706e8a5e17ccd87266a5c154cd938974d380cb21 100644
index 6ffb81f09e7422adeb29f0651a9d3b6e7f6860d3..2ebfa60a2b0175a9cb107648652c9150d9f93732 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -901,7 +901,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -13,7 +13,7 @@ index 8a037e12ba9419ec29c62799e30312c50b7ee4ad..706e8a5e17ccd87266a5c154cd938974
try {
this.isSaving = true;
- this.getPlayerList().saveAll();
+ this.getPlayerList().saveAll(); // Diff on change
+ this.getPlayerList().saveAll(); // Paper - Incremental chunk and player saving; diff on change
flag3 = this.saveAllChunks(suppressLogs, flush, force);
} finally {
this.isSaving = false;
@ -30,11 +30,11 @@ index 8a037e12ba9419ec29c62799e30312c50b7ee4ad..706e8a5e17ccd87266a5c154cd938974
- this.saveEverything(true, false, false);
- this.profiler.pop();
- MinecraftServer.LOGGER.debug("Autosave finished");
+ // Paper start - incremental chunk and player saving
+ // Paper start - Incremental chunk and player saving
+ int playerSaveInterval = io.papermc.paper.configuration.GlobalConfiguration.get().playerAutoSave.rate;
+ if (playerSaveInterval < 0) {
+ playerSaveInterval = autosavePeriod;
}
+ }
+ this.profiler.push("save");
+ final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
+ try {
@ -49,41 +49,41 @@ index 8a037e12ba9419ec29c62799e30312c50b7ee4ad..706e8a5e17ccd87266a5c154cd938974
+ }
+ } finally {
+ this.isSaving = false;
+ }
}
+ this.profiler.pop();
+ // Paper end
+ // Paper end - Incremental chunk and player saving
io.papermc.paper.util.CachedLists.reset(); // Paper
// Paper start - move executeAll() into full server tick timing
try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 974b4970be214ca36a801d39932abcc751e540a5..63fad53a9184d7ab97f143b7d85ae9ef2ca9f8bc 100644
index 974b4970be214ca36a801d39932abcc751e540a5..c7a8078e4bb4df5ad2345125d49c6b40611da539 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -450,6 +450,15 @@ public class ServerChunkCache extends ChunkSource {
} // Paper - Timings
}
+ // Paper start - duplicate save, but call incremental
+ // Paper start - Incremental chunk and player saving; duplicate save, but call incremental
+ public void saveIncrementally() {
+ this.runDistanceManagerUpdates();
+ try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings
+ this.chunkMap.saveIncrementally();
+ } // Paper - Timings
+ }
+ // Paper end
+ // Paper end - Incremental chunk and player saving
+
@Override
public void close() throws IOException {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 51379dc93af2eaa3294179debe067d62627b60e1..8a7dd236435b08e0857041641eec9edcef936503 100644
index 51379dc93af2eaa3294179debe067d62627b60e1..b0d5eca878e391fa29dd81947b6e79b113122ab3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1306,6 +1306,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos);
}
+ // Paper start - derived from below
+ // Paper start - Incremental chunk and player saving
+ public void saveIncrementally(boolean doFull) {
+ ServerChunkCache chunkproviderserver = this.getChunkSource();
+
@ -112,32 +112,32 @@ index 51379dc93af2eaa3294179debe067d62627b60e1..8a7dd236435b08e0857041641eec9edc
+ // CraftBukkit end
+ }
+ }
+ // Paper end
+ // Paper end - Incremental chunk and player saving
+
public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) {
// Paper start - rewrite chunk system - add close param
this.save(progressListener, flush, savingDisabled, false);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d43bf7ff39e9424f5cdcc93d29779570c8735869..fddbd703071ec93d6e3a9ecc1ff17b3e74eb8986 100644
index da445644b1f2de9f80e8198a8ed150103627187b..6d083f49ba3700ff3bc222e594b6d9545dd4edba 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -190,6 +190,7 @@ import org.bukkit.inventory.MainHand;
public class ServerPlayer extends Player {
private static final Logger LOGGER = LogUtils.getLogger();
+ public long lastSave = MinecraftServer.currentTick; // Paper
+ public long lastSave = MinecraftServer.currentTick; // Paper - Incremental chunk and player saving
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32;
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
private static final int FLY_STAT_RECORDING_SPEED = 25;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 5c5d1e387ea00a17db99b3ef1f68eede01b09789..43bdada020a5a28cbe9eb18ec24529be633a49f3 100644
index 5c5d1e387ea00a17db99b3ef1f68eede01b09789..38ff44cdcf9720d916de228f02d579b5e37bc45a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -552,6 +552,7 @@ public abstract class PlayerList {
protected void save(ServerPlayer player) {
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
+ player.lastSave = MinecraftServer.currentTick; // Paper
+ player.lastSave = MinecraftServer.currentTick; // Paper - Incremental chunk and player saving
this.playerIo.save(player);
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
@ -145,7 +145,7 @@ index 5c5d1e387ea00a17db99b3ef1f68eede01b09789..43bdada020a5a28cbe9eb18ec24529be
}
public void saveAll() {
+ // Paper start - incremental player saving
+ // Paper start - Incremental chunk and player saving
+ this.saveAll(-1);
+ }
+
@ -161,7 +161,7 @@ index 5c5d1e387ea00a17db99b3ef1f68eede01b09789..43bdada020a5a28cbe9eb18ec24529be
+ this.save(entityplayer);
+ if (interval != -1 && ++numSaved >= io.papermc.paper.configuration.GlobalConfiguration.get().playerAutoSave.maxPerTick()) { break; }
+ }
+ // Paper end
+ // Paper end - Incremental chunk and player saving
}
MinecraftTimings.savePlayers.stopTiming(); // Paper
return null; }); // Paper - ensure main

View File

@ -8,19 +8,19 @@ We have stored UUID in plenty of places that did not get DFU'd
So just look for old format and load it if it exists.
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
index 135530bc9d7ecd0348ace6474f4ca6d2e1bad283..4c8f2dbdd6e384be026ae1c890096f89fd744eb0 100644
index 135530bc9d7ecd0348ace6474f4ca6d2e1bad283..22106323902ceb4fc58a95918c754234a581f7a1 100644
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
@@ -237,6 +237,12 @@ public class CompoundTag implements Tag {
}
public void putUUID(String key, UUID value) {
+ // Paper start - support old format
+ // Paper start - Support old UUID format
+ if (this.contains(key + "Most", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC) && this.contains(key + "Least", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
+ this.tags.remove(key + "Most");
+ this.tags.remove(key + "Least");
+ }
+ // Paper end
+ // Paper end - Support old UUID format
this.tags.put(key, NbtUtils.createUUID(value));
}
@ -28,39 +28,39 @@ index 135530bc9d7ecd0348ace6474f4ca6d2e1bad283..4c8f2dbdd6e384be026ae1c890096f89
* You must use {@link #hasUUID(String)} before or else it <b>will</b> throw an NPE.
*/
public UUID getUUID(String key) {
+ // Paper start - support old format
+ // Paper start - Support old UUID format
+ if (!contains(key, 11) && this.contains(key + "Most", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC) && this.contains(key + "Least", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
+ return new UUID(this.getLong(key + "Most"), this.getLong(key + "Least"));
+ }
+ // Paper end
+ // Paper end - Support old UUID format
return NbtUtils.loadUUID(this.get(key));
}
public boolean hasUUID(String key) {
+ // Paper start - support old format
+ // Paper start - Support old UUID format
+ if (this.contains(key + "Most", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC) && this.contains(key + "Least", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
+ return true;
+ }
+ // Paper end
+ // Paper end - Support old UUID format
Tag tag = this.get(key);
return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4;
}
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 4388f2a8b05f5ed2f0934c1693299a4c92072adc..18fad4f083862ace2bc56579883f548f6d697091 100644
index 4388f2a8b05f5ed2f0934c1693299a4c92072adc..ba0726157417cdde1c9bca93a9e37e68d9b2286d 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -72,6 +72,14 @@ public final class NbtUtils {
@Nullable
public static GameProfile readGameProfile(CompoundTag nbt) {
UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID;
+ // Paper start - Support string UUIDs
+ // Paper start - Support old UUID format
+ if (nbt.contains("Id", Tag.TAG_STRING)) {
+ try {
+ uUID = UUID.fromString(nbt.getString("Id"));
+ } catch (IllegalArgumentException ignored){
+ }
+ }
+ // Paper end - Support string UUIDs
+ // Paper end - Support old UUID format
String string = nbt.getString("Name");
try {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Update itemstack legacy name and lore
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 0c4727f383313762893b0a7af7bdeb746c80861a..c5e36e7e96902fc0e8e9bb409907c6424cf223bd 100644
index 0c4727f383313762893b0a7af7bdeb746c80861a..0e700a9530cbf883a9037621794a601c0386a387 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -195,6 +195,44 @@ public final class ItemStack {
@ -57,7 +57,7 @@ index 0c4727f383313762893b0a7af7bdeb746c80861a..c5e36e7e96902fc0e8e9bb409907c642
if (nbttagcompound.contains("tag", 10)) {
this.tag = nbttagcompound.getCompound("tag").copy();
this.processEnchantOrder(this.tag); // Paper
+ this.processText(); // Paper
+ this.processText(); // Paper - Update itemstack legacy name and lore
this.getItem().verifyTagAfterLoad(this.tag);
}

View File

@ -8,55 +8,55 @@ Adds a new event for all crafting stations that generate a result slot item
Anvil, Grindstone and Smithing now extend this event
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index e97953e3dad164862d7e2f86bd86a6eff5b80ae2..f00638e9d7baf8b803dd610f2bf6250da34efab3 100644
index e97953e3dad164862d7e2f86bd86a6eff5b80ae2..8e0da4fb2a8f62156e953e0c71a82306d29c5fc4 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -338,6 +338,7 @@ public class AnvilMenu extends ItemCombinerMenu {
}
this.createResult();
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent
return true;
} else {
return false;
diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
index fe1ce65b35e83ee0ada77e44b080729346bb3c2d..819187dbcf468d9278ce33bd97688476aab53f8e 100644
index fe1ce65b35e83ee0ada77e44b080729346bb3c2d..ca3c8b31967a6efd7b0caacb091ab2151e7c0bee 100644
--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
@@ -150,6 +150,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
this.setupResultSlot(itemstack, itemstack1, itemstack2);
}
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent
}
private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) {
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index 45242f0ed5a0f98953df5f27fb76874d2d9e3473..811d7415ae843347da374d73b4edfe89642d518a 100644
index 45242f0ed5a0f98953df5f27fb76874d2d9e3473..1783661f38a6f5fb655ea83953b9467bd91a1302 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -159,6 +159,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
super.slotsChanged(inventory);
if (inventory == this.repairSlots) {
this.createResult();
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent
}
}
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
index 4087e381b2250be387b608d8742f6a6009a52879..ff770b9ce68a62418de0c7ed389650626fa1dcb2 100644
index 4087e381b2250be387b608d8742f6a6009a52879..eb36a69b8da492aec9609cc9ef80d7d68ff9af03 100644
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
@@ -110,6 +110,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
super.slotsChanged(inventory);
if (inventory == this.inputSlots) {
this.createResult();
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, this instanceof SmithingMenu ? 3 : 2); // Paper
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, this instanceof SmithingMenu ? 3 : 2); // Paper - Add PrepareResultEvent
}
}
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index 5c209a3d81db5326f63c506077fa0bfd241b4b12..757ee83a0ec5d381eb328f31f3bef636a9b72d57 100644
index 5c209a3d81db5326f63c506077fa0bfd241b4b12..a98157f600837898dd8ef12671c4bb713e30f30c 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -248,7 +248,8 @@ public class LoomMenu extends AbstractContainerMenu {
@ -64,37 +64,37 @@ index 5c209a3d81db5326f63c506077fa0bfd241b4b12..757ee83a0ec5d381eb328f31f3bef636
}
- this.broadcastChanges();
+ // this.broadcastChanges(); // Paper - done below
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 3); // Paper
+ // this.broadcastChanges(); // Paper - Add PrepareResultEvent; done below
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 3); // Paper - Add PrepareResultEvent
} else {
this.resultSlot.set(ItemStack.EMPTY);
this.selectablePatterns = List.of();
diff --git a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
index 59d9f990a87ab5214fa51e3a6e933bf5ae71b613..857f65be8c4d9ec3a0586017b3f3e8e35cb78b97 100644
index 59d9f990a87ab5214fa51e3a6e933bf5ae71b613..1e9e70263996afa294458364aa70e738b5aabea1 100644
--- a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
@@ -115,6 +115,7 @@ public class SmithingMenu extends ItemCombinerMenu {
}
}
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent
}
@Override
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index 9c2fe69ced7a46bbd8b0fbe10fa67d0a39b0f375..70ecc3f673ebd56b65ad901e10f40c28368cbfac 100644
index 9c2fe69ced7a46bbd8b0fbe10fa67d0a39b0f375..e40d9dbdbe5359c38af6d764d01c9be422654aaa 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -181,6 +181,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
this.setupRecipeList(inventory, itemstack);
}
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent
}
private void setupRecipeList(Container input, ItemStack stack) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 90b93b7139f9a11028b0d78b109b478b8052e982..afccfcab4c1682c47bffe7e3c10a9ec60092e8a0 100644
index 90b93b7139f9a11028b0d78b109b478b8052e982..0e920a0b413c2322832416ef4a2aa661eaae1a89 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1714,26 +1714,53 @@ public class CraftEventFactory {
@ -104,41 +104,41 @@ index 90b93b7139f9a11028b0d78b109b478b8052e982..afccfcab4c1682c47bffe7e3c10a9ec6
- public static PrepareAnvilEvent callPrepareAnvilEvent(InventoryView view, ItemStack item) {
- PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone());
- event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
+ // Paper start - disable this method, handled below
+ // Paper start - Add PrepareResultEvent; disable this method, handled below
+ public static void callPrepareAnvilEvent(InventoryView view, ItemStack item) { // Paper - verify nothing uses return - handled below in PrepareResult
+ PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone
+ //event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // Paper - disable event
event.getInventory().setItem(2, event.getResult());
- return event;
+ //return event; // Paper
+ //return event;
}
+ // Paper end
+ // Paper end - Add PrepareResultEvent
- public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) {
- PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone());
- event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
+ // Paper start - disable this method, handled below
+ // Paper start - Add PrepareResultEvent; disable this method, handled below
+ public static void callPrepareGrindstoneEvent(InventoryView view, ItemStack item) {
+ PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone
+ // event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // Paper - disable event
event.getInventory().setItem(2, event.getResult());
- return event;
+ // return event; // Paper
+ // return event;
}
+ // Paper end
+ // Paper end - Add PrepareResultEvent
- public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) {
- PrepareSmithingEvent event = new PrepareSmithingEvent(view, CraftItemStack.asCraftMirror(item).clone());
- event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
+ // Paper start - disable this method, handled in callPrepareResultEvent
+ // Paper start - Add PrepareResultEvent; disable this method, handled in callPrepareResultEvent
+ public static void callPrepareSmithingEvent(InventoryView view, ItemStack item) { // Paper - verify nothing uses return - handled below in PrepareResult
+ PrepareSmithingEvent event = new PrepareSmithingEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone
+ //event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // Paper - disable event
event.getInventory().setResult(event.getResult());
- return event;
+ //return event; // Paper
}
+ // Paper end
+ }
+ // Paper end - Add PrepareResultEvent
+
+ // Paper start - support specific overrides for prepare result
+ public static void callPrepareResultEvent(AbstractContainerMenu container, int resultSlot) {
@ -158,8 +158,8 @@ index 90b93b7139f9a11028b0d78b109b478b8052e982..afccfcab4c1682c47bffe7e3c10a9ec6
+ event.callEvent();
+ event.getInventory().setItem(resultSlot, event.getResult());
+ container.broadcastChanges();;
+ }
+ // Paper end
}
+ // Paper end - Add PrepareResultEvent
/**
* Mob spawner event.

View File

@ -9,7 +9,7 @@ to race conditions.
Plus, .canUse we want to be safe for async anyways.
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
index 3384501f83d445f45aa8233e98c7597daa67b8ef..6875e15aac37d3566bf04f1a6ee79a21537d2939 100644
index 3384501f83d445f45aa8233e98c7597daa67b8ef..bd12d372a04172504b3664a8136e534ca1b1712d 100644
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
@@ -75,10 +75,10 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
@ -17,16 +17,16 @@ index 3384501f83d445f45aa8233e98c7597daa67b8ef..6875e15aac37d3566bf04f1a6ee79a21
if (source instanceof CommandSourceStack) {
try {
- ((CommandSourceStack) source).currentCommand = this;
+ ((CommandSourceStack) source).currentCommand.put(Thread.currentThread(), this); // Paper
+ ((CommandSourceStack) source).currentCommand.put(Thread.currentThread(), this); // Paper - Thread Safe Vanilla Command permission checking
return this.requirement.test(source);
} finally {
- ((CommandSourceStack) source).currentCommand = null;
+ ((CommandSourceStack) source).currentCommand.remove(Thread.currentThread()); // Paper
+ ((CommandSourceStack) source).currentCommand.remove(Thread.currentThread()); // Paper - Thread Safe Vanilla Command permission checking
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index c772fa3b7a1276b0b41c45c6e0f5584b9c3a90cd..79732086bc4cdbca8364d78eb60d68c758055966 100644
index c772fa3b7a1276b0b41c45c6e0f5584b9c3a90cd..55c394fb00d0c7caee3a06720c37f04db571fe93 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -64,7 +64,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@ -34,7 +34,7 @@ index c772fa3b7a1276b0b41c45c6e0f5584b9c3a90cd..79732086bc4cdbca8364d78eb60d68c7
private final CommandSigningContext signingContext;
private final TaskChainer chatMessageChainer;
- public volatile CommandNode currentCommand; // CraftBukkit
+ public java.util.Map<Thread, CommandNode> currentCommand = new java.util.concurrent.ConcurrentHashMap<>(); // CraftBukkit // Paper - make thread-safe
+ public java.util.Map<Thread, CommandNode> currentCommand = new java.util.concurrent.ConcurrentHashMap<>(); // CraftBukkit // Paper - Thread Safe Vanilla Command permission checking
public boolean bypassSelectorPermissions = false; // Paper - add bypass for selector permissions
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
@ -43,11 +43,11 @@ index c772fa3b7a1276b0b41c45c6e0f5584b9c3a90cd..79732086bc4cdbca8364d78eb60d68c7
public boolean hasPermission(int level) {
// CraftBukkit start
- CommandNode currentCommand = this.currentCommand;
+ // Paper start - fix concurrency issue
+ // Paper start - Thread Safe Vanilla Command permission checking
+ CommandNode currentCommand = this.currentCommand.get(Thread.currentThread());
if (currentCommand != null) {
return this.hasPermission(level, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand));
+ // Paper end
+ // Paper end - Thread Safe Vanilla Command permission checking
}
// CraftBukkit end

View File

@ -10,7 +10,7 @@ This fixes that by checking if the modified spawn location is
still at a respawn anchor.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 43bdada020a5a28cbe9eb18ec24529be633a49f3..29b535dae6eff1c6b47a5d2818fbf0653cd32b8f 100644
index 43bdada020a5a28cbe9eb18ec24529be633a49f3..a50c8728f6ece2ab1f08cacb64cf98790b8a6871 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -806,6 +806,7 @@ public abstract class PlayerList {
@ -40,7 +40,7 @@ index 43bdada020a5a28cbe9eb18ec24529be633a49f3..29b535dae6eff1c6b47a5d2818fbf065
+ location = respawnEvent.getRespawnLocation();
+ isLocAltered = true;
+ }
+ // Paper end
+ // Paper end - Fix SPIGOT-5989
if (!flag) entityplayer.reset(); // SPIGOT-4785
isRespawn = true; // Paper
} else {
@ -57,7 +57,7 @@ index 43bdada020a5a28cbe9eb18ec24529be633a49f3..29b535dae6eff1c6b47a5d2818fbf065
+ worldserver1.setBlock(blockposition, data.setValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE, data.getValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE) - 1), 3);
+ }
+ entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) location.getX(), (double) location.getY(), (double) location.getZ(), 1.0F, 1.0F, worldserver1.getRandom().nextLong()));
+ // Paper end
+ // Paper end - Fix SPIGOT-5989
}
// Added from changeDimension
this.sendAllPlayerInfo(entityplayer); // Update health, etc...

View File

@ -9,7 +9,7 @@ itself, so the criterion object stores no references - and thus
needs no cleanup.
diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
index 5450734060428426981e2c1f1025b1aa5aa4d271..0a22ed467d04c6421f4f8ef227a665ae135a5b0b 100644
index 5450734060428426981e2c1f1025b1aa5aa4d271..805459ba815520165c86a537fbb1f3e04b85bfbd 100644
--- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
+++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
@@ -15,22 +15,22 @@ import net.minecraft.server.level.ServerPlayer;
@ -17,7 +17,7 @@ index 5450734060428426981e2c1f1025b1aa5aa4d271..0a22ed467d04c6421f4f8ef227a665ae
public abstract class SimpleCriterionTrigger<T extends SimpleCriterionTrigger.SimpleInstance> implements CriterionTrigger<T> {
- private final Map<PlayerAdvancements, Set<CriterionTrigger.Listener<T>>> players = Maps.newIdentityHashMap();
+ // private final Map<PlayerAdvancements, Set<CriterionTrigger.Listener<T>>> players = Maps.newIdentityHashMap(); // Paper - moved into AdvancementDataPlayer to fix memory leak
+ // private final Map<PlayerAdvancements, Set<CriterionTrigger.Listener<T>>> players = Maps.newIdentityHashMap(); // Paper - fix AdvancementDataPlayer leak; moved into AdvancementDataPlayer to fix memory leak
@Override
public final void addPlayerListener(PlayerAdvancements manager, CriterionTrigger.Listener<T> conditions) {

View File

@ -5,31 +5,31 @@ Subject: [PATCH] Optimize NetworkManager Exception Handling
diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java
index ac1aa37329bd4d411964ea34ea8147f6db945b9a..41899d6c141895fc6c2c5da763bbe36864d557f7 100644
index ac1aa37329bd4d411964ea34ea8147f6db945b9a..cc96aeebfe96fabc399ba8772a488e48b504e65d 100644
--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java
+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java
@@ -341,6 +341,7 @@ public enum ConnectionProtocol {
@Nullable
public Packet<?> createPacket(int id, FriendlyByteBuf buf) {
+ if (id < 0 || id >= this.idToDeserializer.size()) return null; // Paper
+ if (id < 0 || id >= this.idToDeserializer.size()) return null; // Paper - Perf: Optmize exception handling
Function<FriendlyByteBuf, ? extends Packet<? super T>> function = this.idToDeserializer.get(id);
return function != null ? function.apply(buf) : null;
}
diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
index 00c170a16a57f41f881c6b282cba474ce485b34c..1f71357a4caef4b2cbff95b560d0f3df268b3621 100644
index 00c170a16a57f41f881c6b282cba474ce485b34c..e3c30a096aee3ae0df933647a0c3079e3ae02868 100644
--- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
+++ b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
@@ -39,6 +39,12 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder {
}
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) {
+ // Paper start - if channel is not active just discard the packet
+ // Paper start - Perf: Optmize exception handling; if channel is not active just discard the packet
+ if (!channelHandlerContext.channel().isActive()) {
+ byteBuf.skipBytes(byteBuf.readableBytes());
+ return;
+ }
+ // Paper end - if channel is not active just discard the packet
+ // Paper end - Perf: Optmize exception handling
byteBuf.markReaderIndex();
this.helperBuf.clear();
if (!copyVarint(byteBuf, this.helperBuf)) {

View File

@ -5,42 +5,42 @@ Subject: [PATCH] Fix some rails connecting improperly
diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
index d8dd9f26fe4344541d0544e35bbc66c5d567a80b..dcf49e21208c78b471e6c38cdb0746a0c88fe5a7 100644
index d8dd9f26fe4344541d0544e35bbc66c5d567a80b..6bd4e4d173f34e0234f4474e49ce2d897f85386f 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
@@ -68,6 +68,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl
state = this.updateDir(world, pos, state, true);
if (this.isStraight) {
world.neighborChanged(state, pos, this, pos, notify);
+ state = world.getBlockState(pos); // Paper - don't desync, update again
+ state = world.getBlockState(pos); // Paper - Fix some rails connecting improperly
}
return state;
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
index 41452abc7b761858ff2f3ff6a833b09c16fded4f..8eff69cb70ba094f9dcc0849f0436d4a3498fceb 100644
index 41452abc7b761858ff2f3ff6a833b09c16fded4f..17242c24d73c9ffb1c976a45925f85d1aa9e96b3 100644
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@@ -77,6 +77,7 @@ public class DetectorRailBlock extends BaseRailBlock {
private void checkPressed(Level world, BlockPos pos, BlockState state) {
if (this.canSurvive(state, world, pos)) {
+ if (state.getBlock() != this) { return; } // Paper - not our block, don't do anything
+ if (state.getBlock() != this) { return; } // Paper - Fix some rails connecting improperly
boolean flag = (Boolean) state.getValue(DetectorRailBlock.POWERED);
boolean flag1 = false;
List<AbstractMinecart> list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (entity) -> {
diff --git a/src/main/java/net/minecraft/world/level/block/RailState.java b/src/main/java/net/minecraft/world/level/block/RailState.java
index 0cbfad97371b59de95963a09aa16f3dad7a37222..d873625c1b8439a727d39ce207b5e84a1d86e5eb 100644
index 0cbfad97371b59de95963a09aa16f3dad7a37222..939665cbe4cce36cd64c299908a738a4d1c2140e 100644
--- a/src/main/java/net/minecraft/world/level/block/RailState.java
+++ b/src/main/java/net/minecraft/world/level/block/RailState.java
@@ -17,6 +17,12 @@ public class RailState {
private final boolean isStraight;
private final List<BlockPos> connections = Lists.newArrayList();
+ // Paper start - prevent desync
+ // Paper start - Fix some rails connecting improperly
+ public boolean isValid() {
+ return this.level.getBlockState(this.pos).getBlock() == this.state.getBlock();
+ }
+ // Paper end - prevent desync
+ // Paper end - Fix some rails connecting improperly
+
public RailState(Level world, BlockPos pos, BlockState state) {
this.level = world;
@ -49,11 +49,11 @@ index 0cbfad97371b59de95963a09aa16f3dad7a37222..d873625c1b8439a727d39ce207b5e84a
}
private void connectTo(RailState placementHelper) {
+ // Paper start - prevent desync
+ // Paper start - Fix some rails connecting improperly
+ if (!this.isValid() || !placementHelper.isValid()) {
+ return;
+ }
+ // Paper end - prevent desync
+ // Paper end - Fix some rails connecting improperly
this.connections.add(placementHelper.pos);
BlockPos blockPos = this.pos.north();
BlockPos blockPos2 = this.pos.south();
@ -61,16 +61,16 @@ index 0cbfad97371b59de95963a09aa16f3dad7a37222..d873625c1b8439a727d39ce207b5e84a
this.state = this.state.setValue(this.block.getShapeProperty(), railShape2);
if (forceUpdate || this.level.getBlockState(this.pos) != this.state) {
this.level.setBlock(this.pos, this.state, 3);
+ // Paper start - prevent desync
+ // Paper start - Fix some rails connecting improperly
+ if (!this.isValid()) {
+ return this;
+ }
+ // Paper end - prevent desync
+ // Paper end - Fix some rails connecting improperly
for(int i = 0; i < this.connections.size(); ++i) {
RailState railState = this.getRail(this.connections.get(i));
- if (railState != null) {
+ if (railState != null && railState.isValid()) { // Paper - prevent desync
+ if (railState != null && railState.isValid()) { // Paper - Fix some rails connecting improperly
railState.removeSoftConnections();
if (railState.canConnectTo(this)) {
railState.connectTo(this);
@ -79,6 +79,6 @@ index 0cbfad97371b59de95963a09aa16f3dad7a37222..d873625c1b8439a727d39ce207b5e84a
public BlockState getState() {
- return this.state;
+ return this.level.getBlockState(this.pos); // Paper - prevent desync
+ return this.level.getBlockState(this.pos); // Paper - Fix some rails connecting improperly
}
}

View File

@ -5,19 +5,19 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index fddbd703071ec93d6e3a9ecc1ff17b3e74eb8986..8eb1d297ff0317ac679e85e03d0b4546fa1ed315 100644
index fddbd703071ec93d6e3a9ecc1ff17b3e74eb8986..1635cd4a6e03005c1cdfce82bf3ffa657c3c25ed 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -278,6 +278,7 @@ public class ServerPlayer extends Player {
public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
+ public @Nullable String clientBrandName = null; // Paper - Brand name
+ public @Nullable String clientBrandName = null; // Paper - Brand support
// Paper start - replace player chunk loader
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 44aa178968c87fa72023a2c0f33c1a8123f3db72..f489b207cd3b62a33723f2e9ed0f46020d7f4fd1 100644
index b68301f4cf650891140d3be6aebdc7ddf0d2a54f..f453b3023b713877b286e61d3c60b0b3cfce2cdd 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -55,6 +55,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@ -32,11 +32,11 @@ index 44aa178968c87fa72023a2c0f33c1a8123f3db72..f489b207cd3b62a33723f2e9ed0f4602
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
+ // Paper start - handle brand payload packet
+ // Paper start - Brand support
+ if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload brandPayload) {
+ this.player.clientBrandName = brandPayload.brand();
+ }
+ // Paper end - handle brand payload
+ // Paper end - Brand support
if (!(packet.payload() instanceof ServerboundCustomPayloadPacket.UnknownPayload)) {
return;
}
@ -44,7 +44,7 @@ index 44aa178968c87fa72023a2c0f33c1a8123f3db72..f489b207cd3b62a33723f2e9ed0f4602
try {
byte[] data = new byte[payload.readableBytes()];
payload.readBytes(data);
+ // Paper start - Brand support - Retain this incase upstream decides to 'break' the new mechanism in favour of backwards compat...
+ // Paper start - Brand support; Retain this incase upstream decides to 'break' the new mechanism in favour of backwards compat...
+ if (identifier.equals(MINECRAFT_BRAND)) {
+ try {
+ this.player.clientBrandName = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.copiedBuffer(data)).readUtf(256);
@ -52,7 +52,7 @@ index 44aa178968c87fa72023a2c0f33c1a8123f3db72..f489b207cd3b62a33723f2e9ed0f4602
+ this.player.clientBrandName = "illegal";
+ }
+ }
+ // Paper end
+ // Paper end - Brand support
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Don't require FACING data
diff --git a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
index f25e28098df0a21fd1ae55f5527cddcef9a36b0d..6c78d90e73b47b62c4052727730850d4b67a9cd2 100644
index f25e28098df0a21fd1ae55f5527cddcef9a36b0d..f28705547a62da790f5df071400986aacba39367 100644
--- a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
@@ -14,6 +14,7 @@ import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
+ private Direction enumdirection; // Paper
+ private Direction enumdirection; // Paper - cache facing direction
// CraftBukkit start
private boolean dropper;

View File

@ -5,23 +5,23 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 8a7dd236435b08e0857041641eec9edcef936503..307f2d8adae141cfb7f5fd3c08e68863ce3ed75f 100644
index 8a7dd236435b08e0857041641eec9edcef936503..3be046b4062e9eb9e642c17ba43b4d446e6ba9d7 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2034,9 +2034,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void setDefaultSpawnPos(BlockPos pos, float angle) {
// Paper - configurable spawn radius
BlockPos prevSpawn = this.getSharedSpawnPos();
+ Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper
+ Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper - Call SpawnChangeEvent
//ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
this.levelData.setSpawn(pos, angle);
+ new org.bukkit.event.world.SpawnChangeEvent(this.getWorld(), prevSpawnLoc).callEvent(); // Paper
+ new org.bukkit.event.world.SpawnChangeEvent(this.getWorld(), prevSpawnLoc).callEvent(); // Paper - Call SpawnChangeEvent
if (this.keepSpawnInMemory) {
// if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add
this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange * 16, prevSpawn);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 36d7c41505d41443e6034dfc88ce177fe47d980f..6a6bdc23767d4b0413352eda860f3fd3076f492e 100644
index 36d7c41505d41443e6034dfc88ce177fe47d980f..4fe507969849f8abd12aadb6943a8a2fce27b5b5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -262,12 +262,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -30,16 +30,16 @@ index 36d7c41505d41443e6034dfc88ce177fe47d980f..6a6bdc23767d4b0413352eda860f3fd3
try {
- Location previousLocation = this.getSpawnLocation();
- this.world.levelData.setSpawn(new BlockPos(x, y, z), angle);
+ // Location previousLocation = this.getSpawnLocation(); // Paper - moved to nms.ServerLevel
+ // Location previousLocation = this.getSpawnLocation(); // Paper - Call SpawnChangeEvent; moved to nms.ServerLevel
+ this.world.setDefaultSpawnPos(new BlockPos(x, y, z), angle); // Paper - use ServerLevel#setDefaultSpawnPos
+ // Paper start - move to nms.ServerLevel
+ // Paper start - Call SpawnChangeEvent; move to nms.ServerLevel
// Notify anyone who's listening.
- SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
- this.server.getPluginManager().callEvent(event);
+ // SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
+ // server.getPluginManager().callEvent(event);
+ // Paper end
+ // Paper end - Call SpawnChangeEvent
return true;
} catch (Exception e) {

View File

@ -9,20 +9,20 @@ the game, immediately stop the server to prevent data corruption.
You can override this functionality at your own peril.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 02beedb84a8bec001270116c6ce496db012e6b8a..a95909bc818f395ce5772c5129f9cc9b789ce133 100644
index 02beedb84a8bec001270116c6ce496db012e6b8a..08abe8064f01b20aae0c7a018e11fe2ef42de71b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -124,8 +124,20 @@ public class ChunkSerializer {
InProgressChunkHolder holder = loadChunk(world, poiStorage, chunkPos, nbt, true);
return holder.protoChunk;
}
+ // Paper start
+ // Paper start - Do not let the server load chunks from newer versions
+ private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion();
+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion");
+ // Paper end
+ // Paper end - Do not let the server load chunks from newer versions
public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) {
+ // Paper start - Do NOT attempt to load chunks saved with newer versions
+ // Paper start - Do not let the server load chunks from newer versions
+ if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
+ int dataVersion = nbt.getInt("DataVersion");
+ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Prevent headless pistons from being created
Prevent headless pistons from being created by explosions or tree/mushroom growth.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index b7cf13fe4a0af243c0e76d75439b28d5018dadb9..5a2e322d349340fa58f133c2034765f90319b2be 100644
index b7cf13fe4a0af243c0e76d75439b28d5018dadb9..6a6dd85da2832ba81643031a2e962daf5c27a697 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -206,6 +206,15 @@ public class Explosion {
@ -21,7 +21,7 @@ index b7cf13fe4a0af243c0e76d75439b28d5018dadb9..5a2e322d349340fa58f133c2034765f9
+ set.add(blockposition.relative(direction.getOpposite()));
+ }
+ }
+ // Paper end
+ // Paper end - prevent headless pistons from forming
}
d4 += d0 * 0.30000001192092896D;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add zombie targets turtle egg config
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 79634693899f50e34ffe0898f75e5b31fd11ab53..c82730d52f2ec6cb4a5e17fa512be6497f3ab6dc 100644
index 79634693899f50e34ffe0898f75e5b31fd11ab53..4208f11e031ea8891d22e2da9e513108f0e2d9f3 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -109,7 +109,7 @@ public class Zombie extends Monster {
@ -13,7 +13,7 @@ index 79634693899f50e34ffe0898f75e5b31fd11ab53..c82730d52f2ec6cb4a5e17fa512be649
@Override
protected void registerGoals() {
- this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3));
+ if (this.level().paperConfig().entities.behavior.zombiesTargetTurtleEggs) this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3)); // Paper
+ if (this.level().paperConfig().entities.behavior.zombiesTargetTurtleEggs) this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3)); // Paper - Add zombie targets turtle egg config
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F));
this.goalSelector.addGoal(8, new RandomLookAroundGoal(this));
this.addBehaviourGoals();

View File

@ -8,36 +8,36 @@ the world per tick, this attempts to reduce the impact that join floods
has on the server
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 38650109c1d2683a27da5788dc6013d8d0db26ad..4df0342c38f8ff763a08a145ec94325bcd50689d 100644
index 38650109c1d2683a27da5788dc6013d8d0db26ad..337010178db21cb71fde1a5a7b263bf3609a7f4c 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -498,14 +498,29 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
// Paper end - Optimize network
+ private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper
+ private static int joinAttemptsThisTick; // Paper
+ private static int currTick; // Paper
+ private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world
+ private static int joinAttemptsThisTick; // Paper - Buffer joins to world
+ private static int currTick; // Paper - Buffer joins to world
public void tick() {
this.flushQueue();
+ // Paper start
+ // Paper start - Buffer joins to world
+ if (Connection.currTick != net.minecraft.server.MinecraftServer.currentTick) {
+ Connection.currTick = net.minecraft.server.MinecraftServer.currentTick;
+ Connection.joinAttemptsThisTick = 0;
+ }
+ // Paper end
+ // Paper end - Buffer joins to world
PacketListener packetlistener = this.packetListener;
if (packetlistener instanceof TickablePacketListener) {
TickablePacketListener tickablepacketlistener = (TickablePacketListener) packetlistener;
+ // Paper start - limit the number of joins which can be processed each tick
+ // Paper start - Buffer joins to world
+ if (!(this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginPacketListener)
+ || loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.VERIFYING
+ || Connection.joinAttemptsThisTick++ < MAX_PER_TICK) {
tickablepacketlistener.tick();
+ }
+ // Paper end
+ // Paper end - Buffer joins to world
}
if (!this.isConnected() && !this.disconnectionHandled) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix hex colors not working in some kick messages
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 21aafb1ea51769659462d722aa318460b37cbc1c..5d7f092e966d5b0496f48bd5c9d274157ac6d250 100644
index 21aafb1ea51769659462d722aa318460b37cbc1c..228359f13511262a0e4afeb9deff982ca0f46d9a 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -77,14 +77,16 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@ -23,7 +23,7 @@ index 21aafb1ea51769659462d722aa318460b37cbc1c..5d7f092e966d5b0496f48bd5c9d27415
+ adventureComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(java.text.MessageFormat.format(org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName())); // Spigot // Paper - Fix hex colors not working in some kick messages
}
+ Component ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(adventureComponent); // Paper
+ Component ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(adventureComponent); // Paper - Fix hex colors not working in some kick messages
+
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
this.connection.disconnect(ichatmutablecomponent);

View File

@ -18,7 +18,7 @@ index c5e36e7e96902fc0e8e9bb409907c6424cf223bd..761a46c21aaddcd43b4c33f477658605
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
index e707553bbddf84bc48ec7186da00c3eb0632946d..0e56fbe8836020a0e36c0b6df01ae82d0aa8cf38 100644
index e707553bbddf84bc48ec7186da00c3eb0632946d..91400c16b8bd8953265bf37ec1cd34ac95133e32 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
@@ -142,20 +142,23 @@ public abstract class BaseFireBlock extends Block {
@ -31,7 +31,7 @@ index e707553bbddf84bc48ec7186da00c3eb0632946d..0e56fbe8836020a0e36c0b6df01ae82d
- public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
- if (!oldState.is(state.getBlock())) {
+ public void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, net.minecraft.world.item.context.UseOnContext itemActionContext) {
+ // Paper end
+ // Paper end - ItemActionContext param
+ if (!iblockdata1.is(iblockdata.getBlock())) {
if (BaseFireBlock.inPortalDimension(world)) {
- Optional<PortalShape> optional = PortalShape.findEmptyPortalShape(world, pos, Direction.Axis.X);
@ -52,7 +52,7 @@ index e707553bbddf84bc48ec7186da00c3eb0632946d..0e56fbe8836020a0e36c0b6df01ae82d
}
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
index 8fce3ad36a6ee8166f4abd9e0e369b641d487af9..3fb197ee3bfd3f36881b7d67f7a37f035bb27daf 100644
index 8fce3ad36a6ee8166f4abd9e0e369b641d487af9..0006aec00ab708b1906fbb87d79a9506397c9226 100644
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
@@ -14,6 +14,7 @@ import net.minecraft.server.level.ServerLevel;
@ -73,13 +73,13 @@ index 8fce3ad36a6ee8166f4abd9e0e369b641d487af9..3fb197ee3bfd3f36881b7d67f7a37f03
+ // Paper start - ItemActionContext param
+ public void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, UseOnContext itemActionContext) {
+ super.onPlace(iblockdata, world, blockposition, iblockdata1, flag, itemActionContext);
+ // Paper end
+ // Paper end - ItemActionContext param
+ world.scheduleTick(blockposition, this, getFireTickDelay(world.random));
}
private static int getFireTickDelay(RandomSource random) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 79ff216e473ebc4bf7ab3ade42b0fa224f7e4c19..fb46c66d916931fd80a99c59030ca05e12d29953 100644
index 79ff216e473ebc4bf7ab3ade42b0fa224f7e4c19..b144bf37fc4ee93b77d4bbef750b2531ebfef813 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -43,6 +43,7 @@ import net.minecraft.world.item.DyeColor;
@ -99,12 +99,12 @@ index 79ff216e473ebc4bf7ab3ade42b0fa224f7e4c19..fb46c66d916931fd80a99c59030ca05e
+ public void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, UseOnContext itemActionContext) {
+ this.onPlace(iblockdata, world, blockposition, iblockdata1, flag);
+ }
+ // Paper end
+ // Paper end - ItemActionContext param
/** @deprecated */
@Deprecated
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
index 9fc4997277dd199cf6cffccceb3a9735398c5356..590cd053a1b1c2a489772a2879998725fe0d783c 100644
index 9fc4997277dd199cf6cffccceb3a9735398c5356..39321dd4e60be218cb839a89f6cdf32702b72939 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
@@ -11,6 +11,7 @@ import net.minecraft.tags.BlockTags;
@ -123,7 +123,7 @@ index 9fc4997277dd199cf6cffccceb3a9735398c5356..590cd053a1b1c2a489772a2879998725
+ // Paper start - ItemActionContext param
+ @Deprecated public boolean createPortalBlocks() { return this.createPortalBlocks(null); }
+ public boolean createPortalBlocks(UseOnContext itemActionContext) {
+ // Paper end
+ // Paper end - ItemActionContext param
org.bukkit.World bworld = this.level.getMinecraftWorld().getWorld();
// Copy below for loop

View File

@ -8,7 +8,7 @@ public net.minecraft.world.entity.monster.Evoker setWololoTarget(Lnet/minecraft/
public net.minecraft.world.entity.monster.Evoker getWololoTarget()Lnet/minecraft/world/entity/animal/Sheep;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
index 93ffe2ac37b03aa289881f5f12c7aa7f1d835eda..b66dd5c5c5d98c9285e0d0a4ad4b99a66419f732 100644
index 93ffe2ac37b03aa289881f5f12c7aa7f1d835eda..3a890cccf1766758794f3a3b5d31428f42590049 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
@@ -1,5 +1,6 @@
@ -23,7 +23,7 @@ index 93ffe2ac37b03aa289881f5f12c7aa7f1d835eda..b66dd5c5c5d98c9285e0d0a4ad4b99a6
this.getHandle().setIsCastingSpell(spell == null ? SpellcasterIllager.IllagerSpell.NONE : SpellcasterIllager.IllagerSpell.byId(spell.ordinal()));
}
+
+ // Paper start
+ // Paper start - Add more Evoker API
+ @Override
+ public org.bukkit.entity.Sheep getWololoTarget() {
+ Sheep sheep = getHandle().getWololoTarget();
@ -34,5 +34,5 @@ index 93ffe2ac37b03aa289881f5f12c7aa7f1d835eda..b66dd5c5c5d98c9285e0d0a4ad4b99a6
+ public void setWololoTarget(org.bukkit.entity.Sheep sheep) {
+ getHandle().setWololoTarget(sheep == null ? null : ((org.bukkit.craftbukkit.entity.CraftSheep) sheep).getHandle());
+ }
+ // Paper end
+ // Paper end - Add more Evoker API
}

View File

@ -31,7 +31,7 @@ index 101871664077577c5cbe159d5d1a31b0e30ec68d..0a2f711b7feba83b39c042df71b3dc65
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e1ce61dcadf325633ed809eef92fc07bac4cbf05..8a613a8a874b8b3949630fcadc25cf39b7fb0659 100644
index e1ce61dcadf325633ed809eef92fc07bac4cbf05..e8ef81a7224ed134e3042534c96f13a0d4bf7035 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -162,6 +162,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -46,7 +46,7 @@ index e1ce61dcadf325633ed809eef92fc07bac4cbf05..8a613a8a874b8b3949630fcadc25cf39
}
public void moveTo(double x, double y, double z, float yaw, float pitch) {
+ // Paper - Fix Entity Teleportation and cancel velocity if teleported
+ // Paper start - Fix Entity Teleportation and cancel velocity if teleported
+ if (!preserveMotion) {
+ this.deltaMovement = Vec3.ZERO;
+ } else {

View File

@ -16,7 +16,7 @@ This lets us get faster foreach iteration, as well as avoids map lookups on
the values when needed.
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
index 8519383a9abd45434c1e9888e77548941a80c79c..1d51e113b17a5c522fa7812b1c1f38bf790d8335 100644
index 8519383a9abd45434c1e9888e77548941a80c79c..eb18494bd7257fa5eb00dea16cf4d5667b796f2b 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
@@ -38,9 +38,12 @@ public class PathFinder {
@ -40,7 +40,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..1d51e113b17a5c522fa7812b1c1f38bf
@Nullable
- private Path findPath(ProfilerFiller profiler, Node startNode, Map<Target, BlockPos> positions, float followRange, int distance, float rangeMultiplier) {
+ // Paper start - Perf: remove streams and optimize collection - optimize collection
+ // Paper start - Perf: remove streams and optimize collection
+ private Path findPath(ProfilerFiller profiler, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
profiler.push("find_path");
profiler.markForCharting(MetricCategory.PATH_FINDING);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Beacon API - custom effect ranges
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..0669219b230b127a09741d0073929b2ff68c64af 100644
index cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..7205d0ea78af545108719c1373ba7946ede34ae6 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -82,6 +82,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
@ -55,7 +55,7 @@ index cd28ee0cbc69713a641a21c9a626c694a4bcbfc9..0669219b230b127a09741d0073929b2f
+ // Paper end - Custom beacon ranges
{
- double d0 = (double) (i * 10 + 10);
+ double d0 = blockEntity != null ? blockEntity.getEffectRange() : (i * 10 + 10);// Paper - Custom beacon ranges
+ double d0 = blockEntity != null ? blockEntity.getEffectRange() : (i * 10 + 10); // Paper - Custom beacon ranges
AABB axisalignedbb = (new AABB(blockposition)).inflate(d0).expandTowards(0.0D, (double) world.getHeight(), 0.0D);
List<Player> list = world.getEntitiesOfClass(Player.class, axisalignedbb);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add API for quit reason
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 4df0342c38f8ff763a08a145ec94325bcd50689d..673dfdcd212a9a02e2e690084c280b4af904a470 100644
index 337010178db21cb71fde1a5a7b263bf3609a7f4c..0bc07a1748a5a979c6f6404c620331c3bbdb401f 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -183,12 +183,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -25,19 +25,19 @@ index 4df0342c38f8ff763a08a145ec94325bcd50689d..673dfdcd212a9a02e2e690084c280b4a
Connection.LOGGER.debug("Failed to sent packet", throwable);
if (this.getSending() == PacketFlow.CLIENTBOUND) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 8eb1d297ff0317ac679e85e03d0b4546fa1ed315..d1de7aedc4ecaffed53c356224e3e670fd70256c 100644
index 1635cd4a6e03005c1cdfce82bf3ffa657c3c25ed..ea38d4eb1b4f98ba230ce44deedfd5cb2065edac 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -279,6 +279,7 @@ public class ServerPlayer extends Player {
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public @Nullable String clientBrandName = null; // Paper - Brand name
public @Nullable String clientBrandName = null; // Paper - Brand support
+ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
// Paper start - replace player chunk loader
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 81d4613a23dd0ffc442f0a4e2cbc84d82134dda7..98751a16f1dc372e2f517d48e8a7584b0370e65e 100644
index f453b3023b713877b286e61d3c60b0b3cfce2cdd..825b8f541fe3f5e4cb53f465232c19398b8e66ab 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -315,6 +315,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@ -49,7 +49,7 @@ index 81d4613a23dd0ffc442f0a4e2cbc84d82134dda7..98751a16f1dc372e2f517d48e8a7584b
this.connection.disconnect(ichatbasecomponent);
}));
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 29b535dae6eff1c6b47a5d2818fbf0653cd32b8f..35d9aae5ae0618e6509a3d452e0609326e2737c0 100644
index a50c8728f6ece2ab1f08cacb64cf98790b8a6871..1639c7dda7a4eb29cff489b49590152029d89ea3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -579,7 +579,7 @@ public abstract class PlayerList {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Limit recipe packets
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6e1bfe5342e23a0dd97dfbc06a43bf77dfab23cc..a3715ab0d5f7ae33ba64e69b391e12a00b2e59e9 100644
index 6e1bfe5342e23a0dd97dfbc06a43bf77dfab23cc..4bf01aff2716a26e3db7d3778ef3f9e1e529dc74 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -258,6 +258,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -31,7 +31,7 @@ index 6e1bfe5342e23a0dd97dfbc06a43bf77dfab23cc..a3715ab0d5f7ae33ba64e69b391e12a0
+ // Paper start - auto recipe limit
+ if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
+ this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper
+ this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0])));
+ return;
+ }
+ }

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Add BlockPreDispenseEvent
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
index 5593a0aa9e618071b6521b213dde0f628348c3dc..1ee863ec252872deb15a6b96f1d937c672ce5898 100644
index 5593a0aa9e618071b6521b213dde0f628348c3dc..644e64850479cea20a98b8a65503ccf3a34fd32a 100644
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
@@ -104,6 +104,7 @@ public class DispenserBlock extends BaseEntityBlock {
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
if (idispensebehavior != DispenseItemBehavior.NOOP) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - Add BlockPreDispenseEvent
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - Add BlockPreDispenseEvent
DispenserBlock.eventFired = false; // CraftBukkit - reset event status
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
}

View File

@ -59,7 +59,7 @@ index 2e93eec8733c5b548a15269a322fe4dd1f189b7d..69b18e312db984eaffa8bae2439c88f7
public void windowClosing(WindowEvent windowevent) {
if (!servergui.isClosing.getAndSet(true)) {
diff --git a/src/main/java/net/minecraft/server/gui/StatsComponent.java b/src/main/java/net/minecraft/server/gui/StatsComponent.java
index 7938029cb7aa6f09f78fb1c648357c36edb68510..ed94bc86ed47719c2f6c338374edf741bd202c24 100644
index 7938029cb7aa6f09f78fb1c648357c36edb68510..38fe7e5014332f45e41a3d5d91c28dd0acfdc3b0 100644
--- a/src/main/java/net/minecraft/server/gui/StatsComponent.java
+++ b/src/main/java/net/minecraft/server/gui/StatsComponent.java
@@ -36,8 +36,17 @@ public class StatsComponent extends JComponent {
@ -85,7 +85,7 @@ index 7938029cb7aa6f09f78fb1c648357c36edb68510..ed94bc86ed47719c2f6c338374edf741
this.timer.stop();
}
+
+ // Paper - Improve ServerGUI
+ // Paper start - Improve ServerGUI
+ private static String format(double tps) {
+ return (( tps > 21.0 ) ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
+ }

View File

@ -45,7 +45,7 @@ index aee8618e27b893b72931e925724dd683d2e6d2aa..f7c9127346261d83413ca03a1cdaa849
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 300bae3e97bf5bc0c2340a8e360312e77b7f4c6f..4f8239829565568c1381e2f1ebc1d633cb301ac6 100644
index 8184aaff18d2372ae1de0fe1c53e63e1e6e3b2b0..68f6bb415d4b9624f147dc641543bce56bbbca09 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1989,8 +1989,16 @@ public class ServerPlayer extends Player {
@ -94,14 +94,14 @@ index 300bae3e97bf5bc0c2340a8e360312e77b7f4c6f..4f8239829565568c1381e2f1ebc1d633
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 49d29e4b3395d2ebea1ed13338f26c7cfbaa5f72..45f7270fb15aa091772aa921d1e7d82e2547b358 100644
index 49d29e4b3395d2ebea1ed13338f26c7cfbaa5f72..d04669c1d2434c1dbc617777b769e9004359f208 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -73,21 +73,28 @@ public class ServerPlayerGameMode {
}
public boolean changeGameModeForPlayer(GameType gameMode) {
+ // Paper end - Expand PlayerGameModeChangeEvent
+ // Paper start - Expand PlayerGameModeChangeEvent
+ PlayerGameModeChangeEvent event = this.changeGameModeForPlayer(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
+ return event != null && event.isCancelled();
+ }
@ -131,7 +131,7 @@ index 49d29e4b3395d2ebea1ed13338f26c7cfbaa5f72..45f7270fb15aa091772aa921d1e7d82e
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ba02b3004de6efe2d1f69cda0ba759c9f0192767..6a32c25dbef4d8d8b9db96a69ac8c6baf1d640a6 100644
index 5c54f56a350def1c4c7180c05e853fe10d687f74..f1a684e8af0b05c68ccb16cdb9c0e236d1a5834a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2648,7 +2648,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl

View File

@ -48,7 +48,7 @@ index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92
public boolean shouldDisconnect() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6f51ff7e3486049ee6f5186bfe54078d13eae805..eeead619212e475007557a2826e69e45b441bf14 100644
index 448bc8800860f0632a70998375efa5133024c06b..2d330b40cc604c8883a33e56322e419eff9e39cb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2236,7 +2236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -100,7 +100,7 @@ index b9560b4ae5c0867396006119c5dadd7f3b47f78b..f3e32da770f379d46c65a0ba5a100b5f
return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason);
}, true);
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 98751a16f1dc372e2f517d48e8a7584b0370e65e..761dd36bcf0318e28613d852f95566879d835912 100644
index 825b8f541fe3f5e4cb53f465232c19398b8e66ab..3049377685ee4fe75f0c4b68eab39a916ac20785 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -95,7 +95,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@ -209,7 +209,7 @@ index 98751a16f1dc372e2f517d48e8a7584b0370e65e..761dd36bcf0318e28613d852f9556687
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8b45e0fa29cd4bfb31e3d19df876da38567899f6..29f1a054c31d00fe7ba4c5d171c47efa9275f32d 100644
index 05a94d320e4591d77a99c09975aab4dc30ff9a1e..29f1a054c31d00fe7ba4c5d171c47efa9275f32d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -413,7 +413,7 @@ index 8b45e0fa29cd4bfb31e3d19df876da38567899f6..29f1a054c31d00fe7ba4c5d171c47efa
// Paper start - auto recipe limit
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
- this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper
- this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0])));
+ this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
@ -437,7 +437,7 @@ index 8b45e0fa29cd4bfb31e3d19df876da38567899f6..29f1a054c31d00fe7ba4c5d171c47efa
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index a0f1d9ca16551adef2cacb16576b91810eefa292..3e88b648cf4fcc19598fb50ca5651af1a52a0a84 100644
index 62a005826cd4a26927cde13cfb3551c1f187bfbe..3ae5efb964f3c791b58d4d336881cf189169f7f3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -684,7 +684,7 @@ public abstract class PlayerList {

View File

@ -17,7 +17,7 @@ index 90f5e7d36719dc9b464dd6ba0335da035bab29d3..006a7876a0c8e1180dada6694992f596
};
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 6518d7972f7902b3f7b65d7e5f6629491b531f22..394af8382455d2a039534b87142679f52dc8f2a6 100644
index cfac6c239189c322fba11c86230f3ad34e0eae67..0292ca014fd8319fe9f5e7a1465ee5c112ef6515 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1413,7 +1413,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -54,17 +54,15 @@ index 6518d7972f7902b3f7b65d7e5f6629491b531f22..394af8382455d2a039534b87142679f5
}
}
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
index 8b0efc4d78a04effddae0799b7ee5759ed5c720f..dfd53ca465c9d4864020c14a49f4e74b717df5d6 100644
index 1ced6d60a74fac028804b3c2d938e89af4706823..db6aa75d642f4a7258f197933671907faf79c8f2 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -689,8 +689,8 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
@@ -689,7 +689,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
this.invFriction = 0.05F;
if (this.oldStatus == Boat.Status.IN_AIR && this.status != Boat.Status.IN_AIR && this.status != Boat.Status.ON_LAND) {
this.waterLevel = this.getY(1.0D);
- this.setPos(this.getX(), (double) (this.getWaterLevelAbove() - this.getBbHeight()) + 0.101D, this.getZ());
- this.setDeltaMovement(this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D));
+ this.move(MoverType.SELF, new Vec3(0.0, ((double) (this.getWaterLevelAbove() - this.getBbHeight()) + 0.101D) - this.getY(), 0.0)); // Paper - Improve boat collision performance
+ this.setDeltaMovement(this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D)); // Paper - Improve boat collision performance
this.setDeltaMovement(this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D));
this.lastYd = 0.0D;
this.status = Boat.Status.IN_WATER;
} else {

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Detail more information in watchdog dumps
- Dump player name, player uuid, position, and world for packet handling
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index c48316527013dce0d572524c28b2f5d135e82c71..db18b41e300cb48b3bede8670295aa76e89069ad 100644
index 872ad936dd86b510f24676fe565eb547b35bcb5e..20cd5c5d197d92f7127aadad063c4aabfc4863a6 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -521,7 +521,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -22,7 +22,7 @@ index c48316527013dce0d572524c28b2f5d135e82c71..db18b41e300cb48b3bede8670295aa76
+ net.minecraft.network.protocol.PacketUtils.packetProcessing.pop();
+ } // Paper end - detailed watchdog information
}
// Paper end
// Paper end - Buffer joins to world
}
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 7de24c39b460e43d27839b3821e67213508ece81..7297bca9224c12d7ace0e1967340d99436afafc1 100644
@ -76,7 +76,7 @@ index 7de24c39b460e43d27839b3821e67213508ece81..7297bca9224c12d7ace0e1967340d994
});
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e61a5e2b1ba1f8f54aac14bb61efb8c5ffca2bf9..bf88a776a600a63ddcc079aa981c5838c995521a 100644
index 922639eee09ff9878a979ebfdaa36f865746cbdd..c6c69ea8a471eff84256f1a66d4eda98f55c269e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1244,7 +1244,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -122,7 +122,7 @@ index e61a5e2b1ba1f8f54aac14bb61efb8c5ffca2bf9..bf88a776a600a63ddcc079aa981c5838
private void tickPassenger(Entity vehicle, Entity passenger) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 563c26b7f25f51ae8f256d516b2085ccedac7bcd..d84d696146214f5075bb13a484c4535149faa72f 100644
index f3f12e2394a85fd49ba0bc14944b0f073ca5fecc..bbc8a7f27ffdeda8f994b04213e631e1b82ee67c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1031,7 +1031,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add fire-tick-delay option
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
index 3fb197ee3bfd3f36881b7d67f7a37f035bb27daf..03310fe5d05bc9c61df221977c071757a488c352 100644
index 0006aec00ab708b1906fbb87d79a9506397c9226..f239755b7ca75de1cf5a194e49d8dbc5a44af6f8 100644
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
@@ -172,7 +172,7 @@ public class FireBlock extends BaseFireBlock {
@ -20,7 +20,7 @@ index 3fb197ee3bfd3f36881b7d67f7a37f035bb27daf..03310fe5d05bc9c61df221977c071757
@@ -373,11 +373,13 @@ public class FireBlock extends BaseFireBlock {
public void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, UseOnContext itemActionContext) {
super.onPlace(iblockdata, world, blockposition, iblockdata1, flag, itemActionContext);
// Paper end
// Paper end - ItemActionContext param
- world.scheduleTick(blockposition, this, getFireTickDelay(world.random));
+ world.scheduleTick(blockposition, this, getFireTickDelay(world)); // Paper - Add fire-tick-delay option
}

View File

@ -7,11 +7,11 @@ For larger ranges, it's better to iterate over the player list
than the entity slices.
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index 720d798e9eb38aa97f39c5aa8c3c03671d72bdad..2250d77b0ec5ea77e3b757e03b62b26ced89a02f 100644
index 44660b9f3d8ef6df42dc05e774a5804fdbfa5d14..3ccc0a8d2091d45100198f2853c17edf62c27728 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -329,7 +329,22 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
double d0 = blockEntity != null ? blockEntity.getEffectRange() : (i * 10 + 10);// Paper - Custom beacon ranges
double d0 = blockEntity != null ? blockEntity.getEffectRange() : (i * 10 + 10); // Paper - Custom beacon ranges
AABB axisalignedbb = (new AABB(blockposition)).inflate(d0).expandTowards(0.0D, (double) world.getHeight(), 0.0D);
- List<Player> list = world.getEntitiesOfClass(Player.class, axisalignedbb);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Deep clone unhandled nbt tags
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index b7c0c9a40dac3e828f880ef928ca34206a898cb9..678cebb12e290a9a3967177d97a67bebb9116104 100644
index b7c0c9a40dac3e828f880ef928ca34206a898cb9..2a79d94abf911c9c973e84f81283e8e64fbef2b8 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -305,7 +305,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@ -13,7 +13,7 @@ index b7c0c9a40dac3e828f880ef928ca34206a898cb9..678cebb12e290a9a3967177d97a67beb
private CompoundTag internalTag;
- final Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper
+ Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper & Deep clone unhandled nbt tags; remove final
+ Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper - Deep clone unhandled nbt tags; remove final
private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftMetaItem.DATA_TYPE_REGISTRY);
private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only

View File

@ -34,7 +34,7 @@ The results indicate that this logic is 5 times faster than Vanilla
and 2.3 times faster than Lithium.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 7bb8dc1f4697960cdc6bac0daec4b7a06a2dd7c4..210b6d71207b99e66ba014b176b2c1445053b1d1 100644
index d8a57d38d263e1d402327c7df21641b0f1ba0668..1fa02130dcb65b3109fde0cb612b538b1c4cd4cb 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -111,6 +111,271 @@ public class Explosion {
@ -424,7 +424,7 @@ index 7bb8dc1f4697960cdc6bac0daec4b7a06a2dd7c4..210b6d71207b99e66ba014b176b2c144
@@ -215,11 +528,12 @@ public class Explosion {
}
}
// Paper end
// Paper end - prevent headless pistons from forming
+ } // Paper - optimise explosions
}

View File

@ -44,10 +44,10 @@ index 44ada45d9bf2d9b48e5de1c3cb1a855902f3884b..2aaf1cc630f9cf4b61ad58d1adde5f93
// CraftBukkit start - modelled on below
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 676087c3addd712939c865b39ddb5d9f0bc7ce25..a52ca83572c21f5977d7d0573de443ef5f931279 100644
index 3a2f0a4ae00c63bcae3ee1e068d10bebe33fab7e..5b0749987a78ce830a882b4fa1210e846c188718 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1492,7 +1492,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1491,7 +1491,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) {
if (doFull) {
@ -56,7 +56,7 @@ index 676087c3addd712939c865b39ddb5d9f0bc7ce25..a52ca83572c21f5977d7d0573de443ef
}
this.timings.worldSaveChunks.startTiming(); // Paper
@@ -1528,7 +1528,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1527,7 +1527,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
@ -65,7 +65,7 @@ index 676087c3addd712939c865b39ddb5d9f0bc7ce25..a52ca83572c21f5977d7d0573de443ef
if (progressListener != null) {
progressListener.progressStage(Component.translatable("menu.savingChunks"));
}
@@ -1551,12 +1551,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1550,12 +1550,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
// CraftBukkit end
}