3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

finish some more patches

Dieser Commit ist enthalten in:
Jake Potrebic 2023-06-07 16:44:11 -07:00
Ursprung b1a2378144
Commit 0ca9f14d58
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
48 geänderte Dateien mit 141 neuen und 125 gelöschten Zeilen

Datei anzeigen

@ -5,10 +5,10 @@ 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 9ae45eaf77ead0a6801046d8946d50eec24612fa..a3f877bf03f75cbfbd128c856322bcd427b95d21 100644
index 682e1cd0f4307bcc716ab82e375bd04cde095aa0..547d09c3a1cd0c5401aacb78886896365ba192e7 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
@@ -65,6 +65,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl
@@ -64,6 +64,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);

Datei anzeigen

@ -9,20 +9,18 @@ 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 4138ba8bdf6f359327dfc86d3402b787ae58c818..f0f38f1a7603cd06aba6adefd370d40b97f2e5b8 100644
index 24892ae367e19038625e243bcdf1bb694632ede5..b080734582e70e4e8d2313c8dc7ab9e0f1294f3d 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
@@ -128,9 +128,22 @@ public class ChunkSerializer {
return holder.protoChunk;
}
@@ -94,7 +94,20 @@ public class ChunkSerializer {
public ChunkSerializer() {}
+ // Paper start
+ 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
public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) {
java.util.ArrayDeque<Runnable> tasksToExecuteOnMain = new java.util.ArrayDeque<>();
// Paper end
public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt) {
+ // Paper start - Do NOT attempt to load chunks saved with newer versions
+ if (nbt.contains("DataVersion", 99)) {
+ int dataVersion = nbt.getInt("DataVersion");
@ -32,6 +30,6 @@ index 4138ba8bdf6f359327dfc86d3402b787ae58c818..f0f38f1a7603cd06aba6adefd370d40b
+ }
+ }
+ // Paper end
ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate
ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos"));
if (!Objects.equals(chunkPos, chunkcoordintpair1)) {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b4f17b9c195081b54d79494d9afaf0da21f292c0..139daac1cc7359be4eebf73b2a578e07c183c750 100644
index 2768e46562f36bcb11cead95e65deb8db4884a12..a7d9ff0e33ae674df20e23561cba9a26bd67395d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -302,6 +302,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -17,7 +17,7 @@ index b4f17b9c195081b54d79494d9afaf0da21f292c0..139daac1cc7359be4eebf73b2a578e07
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
this.lastSeenMessages = new LastSeenMessagesValidator(20);
@@ -3345,6 +3347,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3300,6 +3302,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
@ -25,8 +25,8 @@ index b4f17b9c195081b54d79494d9afaf0da21f292c0..139daac1cc7359be4eebf73b2a578e07
+
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -3372,6 +3376,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -3327,6 +3331,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
try {
byte[] data = new byte[packet.data.readableBytes()];
packet.data.readBytes(data);
@ -42,7 +42,7 @@ index b4f17b9c195081b54d79494d9afaf0da21f292c0..139daac1cc7359be4eebf73b2a578e07
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -3381,6 +3394,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3336,6 +3349,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
@ -56,10 +56,10 @@ index b4f17b9c195081b54d79494d9afaf0da21f292c0..139daac1cc7359be4eebf73b2a578e07
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ef7078780b4829e61048233b60150b26f6a9b792..65d311d01b9d18627f20de5dc89585a9b2055367 100644
index 37e3095e4444097b9b6020d1d0aee27b870c3588..e67e69d36c97bee0880e7f21dab1c9a4ca196baa 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2975,6 +2975,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2906,6 +2906,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
};

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add #setMaxPlayers API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index cfe2dea64104eeaffd6606fdff0d5a1a2c111329..0e22201853ae2befdc6904e194f8bbc6d57fc9f5 100644
index 7f59e8acee468a6adcd251c19e2dff15619cd52e..852ced8023b68d77494f1f04eb365b379f95a651 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -155,7 +155,7 @@ public abstract class PlayerList {
@ -18,7 +18,7 @@ index cfe2dea64104eeaffd6606fdff0d5a1a2c111329..0e22201853ae2befdc6904e194f8bbc6
private int simulationDistance;
private boolean allowCheatsForAllPlayers;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e9c52523142df3a0dd9ae9389c69024eb2fe5386..6af883347c259d043cefd73215d9ce263878e23b 100644
index fcf6585a66a95c3414c2b4eb384b9321aa678c22..e59844bd1bd6a68314b44b947236e3d3194f9102 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -672,6 +672,13 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -5,10 +5,10 @@ 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 06d20e9fde26540d1575975345f3d69405f767d0..959a8a170363227bb8ca833d8399f0c4c3d00004 100644
index 1a904c0d832197b5f820b9dd417c6d38f7fcc311..945fdae271d18d9b25012d0b6876ec65ef8f2711 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1862,9 +1862,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1771,9 +1771,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void setDefaultSpawnPos(BlockPos pos, float angle) {
// Paper - configurable spawn radius
BlockPos prevSpawn = this.getSharedSpawnPos();
@ -21,7 +21,7 @@ index 06d20e9fde26540d1575975345f3d69405f767d0..959a8a170363227bb8ca833d8399f0c4
// 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 3711c2842d4830b4a7dd0cd9fd5a4dea46f75bd2..69187c3809369cf2dbe15a0f99e510e762f682d2 100644
index 4ee07d866c23ffe3061ccf0d663e5d4235b9007e..4e23d00f481697257adf9eae5bed4d02a2d5419b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -260,12 +260,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add moon phase API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index d9be32a5141d7b322f31b61c685ca712cdb45182..3ffea505826bbe4151268ed9cffa5f2ddea27b62 100644
index cb6f5fc352aff449173825d4e7fad9fccb9df915..5f9c3c237b65986f8c425bbc691ac301f8fdebbc 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -984,4 +984,11 @@ public abstract class CraftRegionAccessor implements RegionAccessor {

Datei anzeigen

@ -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 a85ca27817981552680c58ad49866997a875018d..ff2ea0ae47fb6e083cf7dbb992d59416067b5c7d 100644
index d646660f988994d4fdb05901349c5946a2f6c48c..316df76570a7a6843b5a8ed2c44467a0cdf2a6cd 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -183,6 +183,15 @@ public class Explosion {

Datei anzeigen

@ -7,7 +7,7 @@ Add a new event, BellRingEvent, to trigger whenever a player rings a
village bell. Passes along the bell block and the player who rang it.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index a1948b59e5c6bcc4c85d175d3267e9dd091768a6..79c542421199a5d9984f104204b275e050581db5 100644
index 2502da6e68f97a7c37f1756d6845e531da1663c3..6528757c99c55c1d9926da89efed468def758af3 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -332,10 +332,11 @@ public class CraftEventFactory {

Datei anzeigen

@ -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 23fe7c324b8faca954dbef1a5703db6a8763edf6..5d295e1d66b57bbecebc5415b3c64cb38c7249d2 100644
index fae2c89900db222f7319b5675ef4b470beca251b..5371ddc75a371a273b5697e620503da9d23e3fbf 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -108,7 +108,7 @@ public class Zombie extends Monster {

Datei anzeigen

@ -8,12 +8,12 @@ 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 59bb1d340e0be6f15a8c6ac21500cdd909c18a8b..ecc075d22b24f9e70cd3751c9ceea84b903020ae 100644
index e857327b796455953e76ddf70913c37a3f1e2ee2..31bdeff1f6bb536c78240efc2dd9c4774e634e11 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -443,14 +443,29 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -286,14 +286,29 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
}
// Paper end
+ private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper
+ private static int joinAttemptsThisTick; // Paper

Datei anzeigen

@ -986,7 +986,7 @@ index 0000000000000000000000000000000000000000..22a2547810d0c029f29685faddf7ac21
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index bef1da32111cd86358c434f095e91493fadbeed6..004894157f732046e89f124872da86c79af1676f 100644
index e7489dbdb0379f9bf3312e5253cd7ff9d8b3a185..1926daed1749e3481861f85f57612fe74450191b 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -252,6 +252,116 @@ public class RedStoneWireBlock extends Block {

Datei anzeigen

@ -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 50521cbd2af1c723d7caaf298fd052af905802b6..ebb964aa4d6c3e98cb6da54f68370a155658b169 100644
index 94b062874ef9d4935a7ad2c7b45b2e6b786eaa81..4fb1fde4983d81cc35e2c8717984d929460959b8 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -77,12 +77,12 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] PortalCreateEvent needs to know its entity
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 56101f87ef258159f77bc70625162e0473697eb9..4f9f5cc99e071fa562743ce6dc2bb2cc4ffc6340 100644
index 020737fba27b6615905da4ac1724bbac8ec0bf4f..12c0e0096153d1c7166829d6f7417d54d364df67 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -443,7 +443,7 @@ public final class ItemStack {
@@ -447,7 +447,7 @@ public final class ItemStack {
net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition);
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
@ -52,7 +52,7 @@ index 2bc31c28d0d5469476699b69efa6e07325f2a852..4066dd6a638cf2186c628905915f6353
}
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 7afaeab3daca40ea2db7961503090fad119ceb8a..69ec4de4d065481496f5363c8985d2f39cd0191d 100644
index 8c6edd032c927f7d1e04e944b4ce5598d71cdd81..7f88b910dfd0303f69b4fd1c7918a401c1f369f2 100644
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
@@ -13,6 +13,7 @@ import net.minecraft.server.level.ServerLevel;
@ -79,7 +79,7 @@ index 7afaeab3daca40ea2db7961503090fad119ceb8a..69ec4de4d065481496f5363c8985d2f3
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 b245b3912a4e2f4e83872c29c5a9602743b5eccb..61c814a8042d3d4be5ea86ce339c90100bdbe597 100644
index 74f84bfcb1da6186c7a6783512c2fc7ba995215f..a9e8d9c65a809562d4768df348dcd79bec4d0e3c 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
@@ -40,6 +40,7 @@ import net.minecraft.world.item.DyeColor;

Datei anzeigen

@ -10,7 +10,7 @@ public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/Fir
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index cbe5f0a6ba85d2acafa9d0d9b1575d3ccbd11cae..883734f0092d1f968fb5e29e0c92a77dfa399ab0 100644
index c67de2f3bb8b048b8432add4adcb9e6042fb65ad..f92b0151d9e2655191a3a7a009c5da66022dddc1 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -696,5 +696,10 @@ public class CraftBlock implements Block {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Create HoverEvent from ItemStack Entity
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 53915c38df347f8921677c1c175db3822d319009..69d5a9923d1eff576bd3058d6bcc278340d069ca 100644
index f81ed24f624ff6f99ccad8361209cc409c6b9187..f5610d0746b67dfe69dc79d71c4d082c083f2ee4 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -471,5 +471,40 @@ public final class CraftItemFactory implements ItemFactory {
@@ -473,5 +473,40 @@ public final class CraftItemFactory implements ItemFactory {
return nms != null ? net.minecraft.locale.Language.getInstance().getOrDefault(nms.getItem().getDescriptionId(nms)) : null;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Cache block data strings
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4fec26c84cb435756fe4b2dcdfc90716f342f9f1..e2ed1ab01ac95d18aa2d3553ccbc5aabdccfb45e 100644
index b5cc8a2c46b928796c47832ee7430f63f616bfd2..13e5b02080177925e089fc05a02c0f52bd3e3ab3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2050,6 +2050,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2057,6 +2057,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().reloadResources();
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
@ -17,10 +17,10 @@ index 4fec26c84cb435756fe4b2dcdfc90716f342f9f1..e2ed1ab01ac95d18aa2d3553ccbc5aab
if (this.isSameThread()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index d4a204cdd035d1af2fc5a05036a3374ac89974c5..3252ef23ddc5dc839e8062f4c3ed565c990c7418 100644
index 12ea3a50126cd324dd3ee25a0f6c17deb05bd3a1..cd40c4c86b1f5de37fea9c0cd71b2e7b30b9136f 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -521,9 +521,39 @@ public class CraftBlockData implements BlockData {
@@ -525,9 +525,39 @@ public class CraftBlockData implements BlockData {
Preconditions.checkState(CraftBlockData.MAP.put(nms, bukkit) == null, "Duplicate mapping %s->%s", nms, bukkit);
}

Datei anzeigen

@ -9,10 +9,10 @@ as this is how Vanilla teleports entities.
Cancel any pending motion when teleported.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4d2adbf45387b63f60b4a8170906752555a19178..ef3771b178d8d966edb83773186dcfac0fda8e3e 100644
index a7d9ff0e33ae674df20e23561cba9a26bd67395d..461b9838fb1201d203892941ef535d47839e4d4f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -752,7 +752,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -760,7 +760,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return;
}
@ -21,7 +21,7 @@ index 4d2adbf45387b63f60b4a8170906752555a19178..ef3771b178d8d966edb83773186dcfac
this.lastGoodX = this.awaitingPositionFromClient.x;
this.lastGoodY = this.awaitingPositionFromClient.y;
this.lastGoodZ = this.awaitingPositionFromClient.z;
@@ -1657,7 +1657,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1649,7 +1649,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// CraftBukkit end
this.awaitingTeleportTime = this.tickCount;
@ -31,10 +31,10 @@ index 4d2adbf45387b63f60b4a8170906752555a19178..ef3771b178d8d966edb83773186dcfac
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 24ba8dc2a5fc72ade003fa14d337f2c64a0e654e..f8f0be4ebb097c26461ea0fcbce7914ce84e87ed 100644
index 316597f54e6ce8da0869e6398b048c618b4a1a7b..70c5cb20e230d8556612bb3b9728898b5d4d329c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -159,6 +159,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -158,6 +158,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
@ -42,7 +42,7 @@ index 24ba8dc2a5fc72ade003fa14d337f2c64a0e654e..f8f0be4ebb097c26461ea0fcbce7914c
static boolean isLevelAtLeast(CompoundTag tag, int level) {
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@@ -1737,6 +1738,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1771,6 +1772,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public void moveTo(double x, double y, double z, float yaw, float pitch) {
@ -57,7 +57,7 @@ index 24ba8dc2a5fc72ade003fa14d337f2c64a0e654e..f8f0be4ebb097c26461ea0fcbce7914c
this.setYRot(yaw);
this.setXRot(pitch);
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 54a20433483d5b67a6668fcdbddc1654a246fee2..9bf1a37ea8436f3314b28914ae8b1516378eb465 100644
index 65d78f1c93c98695e9a4369693f54751d3a69b25..c63d5df91726839471c1eaaf7fafab3fa1be153b 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -167,6 +167,7 @@ public abstract class BaseSpawner {
@ -69,7 +69,7 @@ index 54a20433483d5b67a6668fcdbddc1654a246fee2..9bf1a37ea8436f3314b28914ae8b1516
if (entity instanceof Mob) {
Mob entityinsentient = (Mob) entity;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 7dfa1884a7b4cdbfc83e62caf96acf8ca65a2a73..841e027722f277649ed1b97464f8fca1e290a809 100644
index 5d01b33df41ecc51e2c2b44bad34a65e823d69ce..7fb674cea2953b10c26f1a2c3b3369ab7767324b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -574,7 +574,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add additional open container api to HumanEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 3f6e9214358c938b39106dd6c3eb652c8549c60b..581d99e0dbf4b1a59389645f01f33aed7a340686 100644
index 2d3a7bb9f68350df136ee3d2e3aed0bbbe1a91cc..43a98bcd8e9fe8b204d6d750e3e301cc644024cb 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -463,6 +463,70 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 959a8a170363227bb8ca833d8399f0c4c3d00004..c73bf7d8c6b009ed5e1f666600d3c470927f564d 100644
index 945fdae271d18d9b25012d0b6876ec65ef8f2711..6b47bff5e385bffefbdfa3b9f9f8366d75af6acc 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1366,6 +1366,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1275,6 +1275,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
} else {
@ -23,10 +23,10 @@ index 959a8a170363227bb8ca833d8399f0c4c3d00004..c73bf7d8c6b009ed5e1f666600d3c470
if (spawnReason != null && !CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
return false;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 52d71b08c8338254a0e50780363155da4f4c1934..77eec518940ae41880e395b3dd051d89bd67c319 100644
index c185083abf2b4527a7fe046d83c64cd2cc5b5bb9..7c713c98201c816a70ac999e86685b1c6bbd372d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -436,10 +436,12 @@ public class ServerPlayerGameMode {
@@ -434,10 +434,12 @@ public class ServerPlayerGameMode {
// return true; // CraftBukkit
}
// CraftBukkit start

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f8f0be4ebb097c26461ea0fcbce7914ce84e87ed..7fe47f6158ca78f522685762e1e990ff6e588b87 100644
index 70c5cb20e230d8556612bb3b9728898b5d4d329c..d223777615fb3636784b33a1f562b7c8a6dff102 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4308,4 +4308,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4336,4 +4336,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
void accept(Entity entity, double x, double y, double z);
}
@ -21,7 +21,7 @@ index f8f0be4ebb097c26461ea0fcbce7914ce84e87ed..7fe47f6158ca78f522685762e1e990ff
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index f6eae5756dd7919938ca8265bfeba84fba3ec644..8bd49ffe7e26e6309407830794fae6b7c91c5600 100644
index 447df549a0d371389b086327b06b74aa1d6647cd..cddf16549f45bbb9a598d5677fbc2195200ba876 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -514,6 +514,11 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 7fe47f6158ca78f522685762e1e990ff6e588b87..3d9447b976fbaedb55b526efba7e5d9e7110ade7 100644
index d223777615fb3636784b33a1f562b7c8a6dff102..a4926cdfeac99b78ca2551a8d0e6f1fab9ca985b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4313,5 +4313,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4341,5 +4341,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet();
}
@ -19,7 +19,7 @@ index 7fe47f6158ca78f522685762e1e990ff6e588b87..3d9447b976fbaedb55b526efba7e5d9e
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 841e027722f277649ed1b97464f8fca1e290a809..7d27284e16d31b06f976ab7b9e04b9da7a6a6813 100644
index 7fb674cea2953b10c26f1a2c3b3369ab7767324b..2b936e32a67c108df9a7f6b335357a25bad6d291 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1343,5 +1343,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e2ed1ab01ac95d18aa2d3553ccbc5aabdccfb45e..e7ee655a87358cbe9a7a21475ef67bfb7956cd65 100644
index 13e5b02080177925e089fc05a02c0f52bd3e3ab3..648056283bb1cbb99faf3e095886ace7d42e46d3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2133,13 +2133,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2140,13 +2140,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.isEnforceWhitelist()) {
PlayerList playerlist = source.getServer().getPlayerList();
UserWhiteList whitelist = playerlist.getWhiteList();

Datei anzeigen

@ -11,11 +11,11 @@ This ensures the crystals/pillars are in expected state when the dragon spawns.
See #3522
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index fd57b5a4cf8906b7bfb7c8c4f57c7b057296c8a3..9ed33e7ebb64ec74be2d2e38a35612786408adff 100644
index 35304d7a60348a2b4e1eec43418086086502e4ab..cae4c52e239bdbb916d69e14617814fd08279f1b 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -417,6 +417,7 @@ public class EndDragonFight {
enderDragon.moveTo(0.0D, 128.0D, 0.0D, this.level.random.nextFloat() * 360.0F, 0.0F);
@@ -412,6 +412,7 @@ public class EndDragonFight {
enderDragon.moveTo((double)this.origin.getX(), (double)(128 + this.origin.getY()), (double)this.origin.getZ(), this.level.random.nextFloat() * 360.0F, 0.0F);
this.level.addFreshEntity(enderDragon);
this.dragonUUID = enderDragon.getUUID();
+ this.resetSpikeCrystals(); // Paper

Datei anzeigen

@ -6,13 +6,13 @@ Subject: [PATCH] Fix for large move vectors crashing server
Check movement distance also based on current position.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ef3771b178d8d966edb83773186dcfac0fda8e3e..910f40b87eb574e77e991acac431a0f61f5b6bf3 100644
index 461b9838fb1201d203892941ef535d47839e4d4f..5cd15898576aa3d3f1c092bf645dd9f1e350cd0e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -567,9 +567,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) {
ServerLevel worldserver = this.player.getLevel();
ServerLevel worldserver = this.player.serverLevel();
- double d0 = entity.getX();
- double d1 = entity.getY();
- double d2 = entity.getZ();
@ -56,37 +56,37 @@ index ef3771b178d8d966edb83773186dcfac0fda8e3e..910f40b87eb574e77e991acac431a0f6
+ d8 = d5 - this.vehicleLastGoodZ; // Paper - diff on change, used for checking large move vectors above
boolean flag1 = entity.verticalCollisionBelow;
entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
@@ -1348,7 +1359,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
double d8 = d1 - this.firstGoodY;
double d9 = d2 - this.firstGoodZ;
double d10 = this.player.getDeltaMovement().lengthSqr();
- double d11 = d7 * d7 + d8 * d8 + d9 * d9;
if (entity instanceof LivingEntity) {
@@ -1344,7 +1355,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
double d7 = d1 - this.firstGoodY;
double d8 = d2 - this.firstGoodZ;
double d9 = this.player.getDeltaMovement().lengthSqr();
- double d10 = d6 * d6 + d7 * d7 + d8 * d8;
+ // Paper start - fix large move vectors killing the server
+ double currDeltaX = toX - prevX;
+ double currDeltaY = toY - prevY;
+ double currDeltaZ = toZ - prevZ;
+ double d11 = Math.max(d7 * d7 + d8 * d8 + d9 * d9, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1);
+ double d10 = Math.max(d7 * d7 + d8 * d8 + d9 * d9, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1);
+ // Paper end - fix large move vectors killing the server
+ // Paper start - fix large move vectors killing the server
+ double otherFieldX = d0 - this.lastGoodX;
+ double otherFieldY = d1 - this.lastGoodY;
+ double otherFieldZ = d2 - this.lastGoodZ;
+ d11 = Math.max(d11, (otherFieldX * otherFieldX + otherFieldY * otherFieldY + otherFieldZ * otherFieldZ) - 1);
+ d10 = Math.max(d10, (otherFieldX * otherFieldX + otherFieldY * otherFieldY + otherFieldZ * otherFieldZ) - 1);
+ // Paper end - fix large move vectors killing the server
if (this.player.isSleeping()) {
if (d11 > 1.0D) {
@@ -1400,9 +1422,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (d10 > 1.0D) {
@@ -1396,9 +1418,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
AABB axisalignedbb = this.player.getBoundingBox();
- d7 = d0 - this.lastGoodX;
- d8 = d1 - this.lastGoodY;
- d9 = d2 - this.lastGoodZ;
+ d7 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above
+ d8 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above
+ d9 = d2 - this.lastGoodZ; // Paper - diff on change, used for checking large move vectors above
boolean flag = d8 > 0.0D;
- d6 = d0 - this.lastGoodX;
- d7 = d1 - this.lastGoodY;
- d8 = d2 - this.lastGoodZ;
+ d6 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above
+ d7 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above
+ d8 = d2 - this.lastGoodZ; // Paper - diff on change, used for checking large move vectors above
boolean flag = d7 > 0.0D;
if (this.player.isOnGround() && !packet.isOnGround() && flag) {
if (this.player.onGround() && !packet.isOnGround() && flag) {

Datei anzeigen

@ -41,7 +41,7 @@ index eebac2ea211f58c385b2ceb36ab911ac5e115296..d1aaca5de055fd5e3bf2c6d39ef397bb
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 5ce19b2dcf9dd2844fe79991fc0260e6141f3394..4167b665abdae0db1425f50ccf175bc35699abca 100644
index f92b0151d9e2655191a3a7a009c5da66022dddc1..cd39ec0e87974be616f10321d953fd2f3af194f7 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -225,7 +225,7 @@ public class CraftBlock implements Block {
@ -67,7 +67,7 @@ index 843a166e43f05fe987e62329593b23656c6a2abb..9068557ac50cfb26e7e3ec4ac64bac58
public void setFlag(int flag) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index 3252ef23ddc5dc839e8062f4c3ed565c990c7418..9d09b3064fc0474170e6d584dd3ccb9899cfbd42 100644
index cd40c4c86b1f5de37fea9c0cd71b2e7b30b9136f..58d10e8909fea652810e30bbd4b24aaa5e038277 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -57,7 +57,7 @@ public class CraftBlockData implements BlockData {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Villager#resetOffers
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
index 8fbed2f8f867c67a6922b31f7394258253de86e7..49bc867f189b0d4c236a47670676cc67920c2cd7 100644
index 78f7f1602b34e9d2162446810b0ee1357fd4922c..0a62cf36a95d7bf1287acdd17464fc677c7a4b7d 100644
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
@@ -115,6 +115,13 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa

Datei anzeigen

@ -10,10 +10,10 @@ In general, look at making this logic more robust (i.e properly handling
cases where a captured entry is overriden) - but for now this will do.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0ef98a3a3f8685c801f74431fcfab88541b6a170..1770c97a3190a89a9b1dbde126b94a42662efea0 100644
index 4aad91def765910d6e8820cb92a288a304a17b5b..485e45962dcbcdcf720ff70e06092dd846e74031 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -158,7 +158,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -157,7 +157,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false;
public Map<BlockPos, org.bukkit.craftbukkit.block.CraftBlockState> capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Reduce blockpos allocation from pathfinding
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
index 67ac0b3cec3b1a9bd6de7be50244804ac1620ab3..94a0fde36dda9404e5eb62d323c71dac1929a46b 100644
index 10503d6d8b6daf645cf4360ee289d5e25144c976..3583fcf5284bc5883308876dbd9886664b391e28 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -471,7 +471,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
@@ -473,7 +473,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
return BlockPathTypes.DANGER_FIRE;
}
@ -16,13 +16,13 @@ index 67ac0b3cec3b1a9bd6de7be50244804ac1620ab3..94a0fde36dda9404e5eb62d323c71dac
+ if (blockState.getFluidState().is(FluidTags.WATER)) {
return BlockPathTypes.WATER_BORDER;
}
} // Paper
@@ -499,7 +499,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
@@ -504,7 +504,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
} else if (blockState.is(Blocks.COCOA)) {
return BlockPathTypes.COCOA;
} else {
} else if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(Blocks.POINTED_DRIPSTONE)) {
- FluidState fluidState = world.getFluidState(pos);
+ FluidState fluidState = blockState.getFluidState(); // Paper - remove another get type call
+ FluidState fluidState = blockState.getFluidState(); // Paper - remove another getFluidState call
if (fluidState.is(FluidTags.LAVA)) {
return BlockPathTypes.LAVA;
} else if (isBurningBlock(blockState)) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Player elytra boost API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 65d311d01b9d18627f20de5dc89585a9b2055367..28d0d184e990e30835d2848a32e53c39dd704319 100644
index e67e69d36c97bee0880e7f21dab1c9a4ca196baa..cfca7a4e71c2f74846238b1bf2fbf2ff094b7a0f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -649,6 +649,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -574,6 +574,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
throw new RuntimeException("Unknown settings type");
}

Datei anzeigen

@ -8,39 +8,39 @@ This can realistically only happen if there's custom loot active on fishing
which can return 0 items. This would disconnect the player who's fishing.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
index 082fa4318dc03defbdb76e99250b7d71aa6710f5..02eb61138ed8e977498bfb9c75b0d4759347154c 100644
index dbff697927e6a6c745377aafd3b476b58f005882..b8c238287e0639b578170c6fec0d4db5a1a59fe7 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
@@ -503,9 +503,15 @@ public class FishingHook extends Projectile {
while (iterator.hasNext()) {
ItemStack itemstack1 = (ItemStack) iterator.next();
- ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY(), this.getZ(), itemstack1);
- ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), itemstack1);
+ // Paper start, new EntityItem would throw if for whatever reason (mostly shitty datapacks) the itemstack1 turns out to be empty
+ // if the item stack is empty we instead just have our entityitem as null
+ ItemEntity entityitem = null;
+ if (!itemstack1.isEmpty()) {
+ entityitem = new ItemEntity(this.level, this.getX(), this.getY(), this.getZ(), itemstack1);
+ entityitem = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), itemstack1);
+ }
+ // Paper end
// CraftBukkit start
- PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), entityitem.getBukkitEntity(), (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) entityhuman.getBukkitEntity(), entityitem != null ? entityitem.getBukkitEntity() : null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH); // Paper - entityitem may be null
playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
this.level.getCraftServer().getPluginManager().callEvent(playerFishEvent);
this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
@@ -518,8 +524,12 @@ public class FishingHook extends Projectile {
double d2 = entityhuman.getZ() - this.getZ();
double d3 = 0.1D;
- entityitem.setDeltaMovement(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D);
- this.level.addFreshEntity(entityitem);
- this.level().addFreshEntity(entityitem);
+ // Paper start, entity item can be null, so we need to check against this
+ if (entityitem != null) {
+ entityitem.setDeltaMovement(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D);
+ this.level.addFreshEntity(entityitem);
+ this.level().addFreshEntity(entityitem);
+ }
+ // Paper end
// CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
if (playerFishEvent.getExpToDrop() > 0) {
entityhuman.level.addFreshEntity(new ExperienceOrb(entityhuman.level, entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getPlayerOwner(), this)); // Paper
entityhuman.level().addFreshEntity(new ExperienceOrb(entityhuman.level(), entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getPlayerOwner(), this)); // Paper

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String)
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6af883347c259d043cefd73215d9ce263878e23b..e7e0059831b19d03da07fbe610a9d20cd1c490ad 100644
index e59844bd1bd6a68314b44b947236e3d3194f9102..5a01f8475829cd3e398a095da50bc01c5dcd092b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1831,6 +1831,28 @@ public final class CraftServer implements Server {
@@ -1829,6 +1829,28 @@ public final class CraftServer implements Server {
return result;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add ignore discounts API
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index ece23ee7812ca62ff8e763ffc29cda2711d2f2e1..279b247f579a46183bdb90064ee169d3f9b0b1e3 100644
index 1e775178f346ef3d2f121e539ba81a75c8a37c36..24434b66d158b10d21579b2db6efb0bdcc788a5c 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -501,6 +501,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -507,6 +507,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
while (iterator.hasNext()) {
MerchantOffer merchantrecipe = (MerchantOffer) iterator.next();
@ -16,7 +16,7 @@ index ece23ee7812ca62ff8e763ffc29cda2711d2f2e1..279b247f579a46183bdb90064ee169d3
merchantrecipe.addToSpecialPriceDiff(-Mth.floor((float) i * merchantrecipe.getPriceMultiplier()));
}
@@ -513,6 +514,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -519,6 +520,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
while (iterator1.hasNext()) {
MerchantOffer merchantrecipe1 = (MerchantOffer) iterator1.next();
@ -25,7 +25,7 @@ index ece23ee7812ca62ff8e763ffc29cda2711d2f2e1..279b247f579a46183bdb90064ee169d3
int k = (int) Math.floor(d0 * (double) merchantrecipe1.getBaseCostA().getCount());
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
index 8de9ea7928b272bbaf9c49940a8079f2499c8ee1..fd50d1c2435b82215bc5b3fdbe5044d426bc342e 100644
index dc5908374565dd3080679779cbfe7620a4810015..28bdcb14cb5b458d3c990fcf343ef97f08e4f3c6 100644
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
@@ -19,6 +19,7 @@ public class MerchantOffer {
@ -82,7 +82,7 @@ index 8de9ea7928b272bbaf9c49940a8079f2499c8ee1..fd50d1c2435b82215bc5b3fdbe5044d4
this.rewardExp = true;
this.xp = 1;
this.baseCostA = firstBuyItem;
@@ -193,6 +212,7 @@ public class MerchantOffer {
@@ -195,6 +214,7 @@ public class MerchantOffer {
nbttagcompound.putFloat("priceMultiplier", this.priceMultiplier);
nbttagcompound.putInt("specialPrice", this.specialPriceDiff);
nbttagcompound.putInt("demand", this.demand);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Toggle for removing existing dragon
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 9ed33e7ebb64ec74be2d2e38a35612786408adff..ed0d1d6285556f0949a7ea81ad692b663ec191a7 100644
index cae4c52e239bdbb916d69e14617814fd08279f1b..58823aeb8316628be716051b74307b01c37ad8a0 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -218,7 +218,7 @@ public class EndDragonFight {
@@ -195,7 +195,7 @@ public class EndDragonFight {
this.dragonUUID = enderDragon.getUUID();
LOGGER.info("Found that there's a dragon still alive ({})", (Object)enderDragon);
this.dragonKilled = false;

Datei anzeigen

@ -15,7 +15,7 @@ manually reload the advancement data for all players, which
normally takes place as a part of the datapack reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 8bd49ffe7e26e6309407830794fae6b7c91c5600..289f6fade5f5500867eb75df41df6b8c5465e185 100644
index cddf16549f45bbb9a598d5677fbc2195200ba876..fbb674d355f30f34de6bb9608e628d5c49047be6 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -347,7 +347,13 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -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 34ec79a4298bff5ef6d751dc06b6439d0fa2e077..b572643536c47f34362b086e46f581417fa1719e 100644
index 8b79df496e1fad57e8c5c0aa97d0d84ab0deed1e..c9b0b0c3fd615bda5f6e633ec33a20751a25d8d9 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
@@ -78,6 +78,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name

Datei anzeigen

@ -5,10 +5,28 @@ 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 ecc075d22b24f9e70cd3751c9ceea84b903020ae..90dd5a5c3ac94782483f99165bb3ddc85c179aae 100644
index 31bdeff1f6bb536c78240efc2dd9c4774e634e11..04f16e56829cc6f2345071a9ca8502a436cb7b44 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -176,12 +176,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -102,6 +102,17 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
this.receiving = side;
}
+ // Paper start
+ @Nullable
+ public net.minecraft.server.level.ServerPlayer getPlayer() {
+ if (this.packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl serverGamePacketListener) {
+ return serverGamePacketListener.player;
+ } else {
+ return null;
+ }
+ }
+ // Paper end
+
public void channelActive(ChannelHandlerContext channelhandlercontext) throws Exception {
super.channelActive(channelhandlercontext);
this.channel = channelhandlercontext.channel();
@@ -149,12 +160,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
this.handlingFault = true;
if (this.channel.isOpen()) {
@ -25,11 +43,11 @@ index ecc075d22b24f9e70cd3751c9ceea84b903020ae..90dd5a5c3ac94782483f99165bb3ddc8
Connection.LOGGER.debug("Failed to sent packet", throwable);
ConnectionProtocol enumprotocol = this.getCurrentProtocol();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5b6ecebcb4585877a2761eb17f4810042320e681..5c38036574951ef4080da5e3315ce516acb53484 100644
index ad33c444100243b45bd8ee8603b21b41109faa2e..f05900394e0a00b8cad67cfbc7bb817513202553 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -276,6 +276,7 @@ public class ServerPlayer extends Player {
public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
@@ -275,6 +275,7 @@ public class ServerPlayer extends Player {
public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
+ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
@ -37,7 +55,7 @@ index 5b6ecebcb4585877a2761eb17f4810042320e681..5c38036574951ef4080da5e3315ce516
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 910f40b87eb574e77e991acac431a0f61f5b6bf3..afebb0d8f5846d4e0d29a495216d1debf30ac4f9 100644
index 5cd15898576aa3d3f1c092bf645dd9f1e350cd0e..5a5b3d412d6982efbbe6fca3f794988ba7d5f704 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -507,6 +507,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -49,10 +67,10 @@ index 910f40b87eb574e77e991acac431a0f61f5b6bf3..afebb0d8f5846d4e0d29a495216d1deb
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 9b75cf08096689522b670ad48e73126ad4cfc9b5..1f739c0e9a6323967719a515bfce6c4885d8dae6 100644
index 852ced8023b68d77494f1f04eb365b379f95a651..f365eb9705ca78dd586c4e6492015d8710514efc 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -566,7 +566,7 @@ public abstract class PlayerList {
@@ -573,7 +573,7 @@ public abstract class PlayerList {
entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper
}