From 6e86dd94227c3388ab610f9215420a0a4cc0413a Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 7 Jun 2023 16:44:11 -0700 Subject: [PATCH] finish some more patches --- .../server/Add-API-for-quit-reason.patch | 20 ++++++++++- .../server/Add-BellRingEvent.patch | 0 ...al-open-container-api-to-HumanEntity.patch | 0 .../Add-getOfflinePlayerIfCached-String.patch | 0 .../server/Add-ignore-discounts-API.patch | 0 .../Add-methods-to-get-translation-keys.patch | 0 .../server/Add-moon-phase-API.patch | 0 .../server/Add-more-Evoker-API.patch | 0 ...yPickupItemAnimation-to-LivingEntity.patch | 0 .../server/Add-setMaxPlayers-API.patch | 0 ...Add-zombie-targets-turtle-egg-config.patch | 0 ...ling-up-when-item-stack-is-empty-in-.patch | 12 +++---- .../Beacon-API-custom-effect-ranges.patch | 0 .../server/Brand-support.patch | 2 +- .../server/Buffer-joins-to-world.patch | 2 +- ...taFixerUpper-Rewrite-Rules-on-demand.patch | 0 .../server/Cache-block-data-strings.patch | 0 ...ate-HoverEvent-from-ItemStack-Entity.patch | 0 ...erver-load-chunks-from-newer-version.patch | 10 +++--- .../server/Don-t-require-FACING-data.patch | 0 .../Eigencraft-redstone-implementation.patch | 0 .../server/Entity-isTicking.patch | 0 ...y-Counter-to-allow-plugins-to-use-va.patch | 0 ...p-capture-to-capture-all-items-added.patch | 0 ...x-Concurrency-issue-in-ShufflingList.patch | 0 .../server/Fix-CraftTeam-null-check.patch | 0 ...ortation-and-cancel-velocity-if-tele.patch | 0 ...geEvent-not-firing-for-all-use-cases.patch | 0 ...ix-client-lag-on-advancement-loading.patch | 0 ...-non-whitelisted-player-when-white-l.patch | 0 ...r-large-move-vectors-crashing-server.patch | 34 +++++++++---------- ...rs-not-working-in-some-kick-messages.patch | 0 ...tem-locations-dropped-from-campfires.patch | 0 ...istake-in-CB-NBT-int-deserialization.patch | 0 ...Fix-some-rails-connecting-improperly.patch | 0 .../Fixed-TileEntityBell-memory-leak.patch | 0 .../server/Item-no-age-no-player-pickup.patch | 0 ...-track-plugin-scoreboards-by-default.patch | 0 .../server/Optimise-getType-calls.patch | 0 ...der-Remove-Streams-Optimized-collect.patch | 0 .../server/Player-elytra-boost-API.patch | 0 ...CreateEvent-needs-to-know-its-entity.patch | 0 ...-headless-pistons-from-being-created.patch | 0 ...blockpos-allocation-from-pathfinding.patch | 6 ++-- ...Reset-Ender-Crystals-on-Dragon-Spawn.patch | 2 +- ...ace-order-when-capturing-blockstates.patch | 0 .../Toggle-for-removing-existing-dragon.patch | 0 .../server/Villager-resetOffers.patch | 0 48 files changed, 52 insertions(+), 36 deletions(-) rename patches/{unapplied => }/server/Add-API-for-quit-reason.patch (87%) rename patches/{unapplied => }/server/Add-BellRingEvent.patch (100%) rename patches/{unapplied => }/server/Add-additional-open-container-api-to-HumanEntity.patch (100%) rename patches/{unapplied => }/server/Add-getOfflinePlayerIfCached-String.patch (100%) rename patches/{unapplied => }/server/Add-ignore-discounts-API.patch (100%) rename patches/{unapplied => }/server/Add-methods-to-get-translation-keys.patch (100%) rename patches/{unapplied => }/server/Add-moon-phase-API.patch (100%) rename patches/{unapplied => }/server/Add-more-Evoker-API.patch (100%) rename patches/{unapplied => }/server/Add-playPickupItemAnimation-to-LivingEntity.patch (100%) rename patches/{unapplied => }/server/Add-setMaxPlayers-API.patch (100%) rename patches/{unapplied => }/server/Add-zombie-targets-turtle-egg-config.patch (100%) rename patches/{unapplied => }/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch (80%) rename patches/{unapplied => }/server/Beacon-API-custom-effect-ranges.patch (100%) rename patches/{unapplied => }/server/Brand-support.patch (99%) rename patches/{unapplied => }/server/Buffer-joins-to-world.patch (99%) rename patches/{unapplied => }/server/Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch (100%) rename patches/{unapplied => }/server/Cache-block-data-strings.patch (100%) rename patches/{unapplied => }/server/Create-HoverEvent-from-ItemStack-Entity.patch (100%) rename patches/{unapplied => }/server/Do-not-let-the-server-load-chunks-from-newer-version.patch (81%) rename patches/{unapplied => }/server/Don-t-require-FACING-data.patch (100%) rename patches/{unapplied => }/server/Eigencraft-redstone-implementation.patch (100%) rename patches/{unapplied => }/server/Entity-isTicking.patch (100%) rename patches/{unapplied => }/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch (100%) rename patches/{unapplied => }/server/Extend-block-drop-capture-to-capture-all-items-added.patch (100%) rename patches/{unapplied => }/server/Fix-Concurrency-issue-in-ShufflingList.patch (100%) rename patches/{unapplied => }/server/Fix-CraftTeam-null-check.patch (100%) rename patches/{unapplied => }/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch (100%) rename patches/{unapplied => }/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch (100%) rename patches/{unapplied => }/server/Fix-client-lag-on-advancement-loading.patch (100%) rename patches/{unapplied => }/server/Fix-deop-kicking-non-whitelisted-player-when-white-l.patch (100%) rename patches/{unapplied => }/server/Fix-for-large-move-vectors-crashing-server.patch (83%) rename patches/{unapplied => }/server/Fix-hex-colors-not-working-in-some-kick-messages.patch (100%) rename patches/{unapplied => }/server/Fix-item-locations-dropped-from-campfires.patch (100%) rename patches/{unapplied => }/server/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch (100%) rename patches/{unapplied => }/server/Fix-some-rails-connecting-improperly.patch (100%) rename patches/{unapplied => }/server/Fixed-TileEntityBell-memory-leak.patch (100%) rename patches/{unapplied => }/server/Item-no-age-no-player-pickup.patch (100%) rename patches/{unapplied => }/server/Lazily-track-plugin-scoreboards-by-default.patch (100%) rename patches/{unapplied => }/server/Optimise-getType-calls.patch (100%) rename patches/{unapplied => }/server/Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch (100%) rename patches/{unapplied => }/server/Player-elytra-boost-API.patch (100%) rename patches/{unapplied => }/server/PortalCreateEvent-needs-to-know-its-entity.patch (100%) rename patches/{unapplied => }/server/Prevent-headless-pistons-from-being-created.patch (100%) rename patches/{unapplied => }/server/Reduce-blockpos-allocation-from-pathfinding.patch (86%) rename patches/{unapplied => }/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch (86%) rename patches/{unapplied => }/server/Retain-block-place-order-when-capturing-blockstates.patch (100%) rename patches/{unapplied => }/server/Toggle-for-removing-existing-dragon.patch (100%) rename patches/{unapplied => }/server/Villager-resetOffers.patch (100%) diff --git a/patches/unapplied/server/Add-API-for-quit-reason.patch b/patches/server/Add-API-for-quit-reason.patch similarity index 87% rename from patches/unapplied/server/Add-API-for-quit-reason.patch rename to patches/server/Add-API-for-quit-reason.patch index f83b22ee49..c65d38ad6f 100644 --- a/patches/unapplied/server/Add-API-for-quit-reason.patch +++ b/patches/server/Add-API-for-quit-reason.patch @@ -8,6 +8,24 @@ diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java +@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { + 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(); @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { this.handlingFault = true; @@ -29,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { - public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks + public boolean isRealPlayer; // Paper public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet 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 diff --git a/patches/unapplied/server/Add-BellRingEvent.patch b/patches/server/Add-BellRingEvent.patch similarity index 100% rename from patches/unapplied/server/Add-BellRingEvent.patch rename to patches/server/Add-BellRingEvent.patch diff --git a/patches/unapplied/server/Add-additional-open-container-api-to-HumanEntity.patch b/patches/server/Add-additional-open-container-api-to-HumanEntity.patch similarity index 100% rename from patches/unapplied/server/Add-additional-open-container-api-to-HumanEntity.patch rename to patches/server/Add-additional-open-container-api-to-HumanEntity.patch diff --git a/patches/unapplied/server/Add-getOfflinePlayerIfCached-String.patch b/patches/server/Add-getOfflinePlayerIfCached-String.patch similarity index 100% rename from patches/unapplied/server/Add-getOfflinePlayerIfCached-String.patch rename to patches/server/Add-getOfflinePlayerIfCached-String.patch diff --git a/patches/unapplied/server/Add-ignore-discounts-API.patch b/patches/server/Add-ignore-discounts-API.patch similarity index 100% rename from patches/unapplied/server/Add-ignore-discounts-API.patch rename to patches/server/Add-ignore-discounts-API.patch diff --git a/patches/unapplied/server/Add-methods-to-get-translation-keys.patch b/patches/server/Add-methods-to-get-translation-keys.patch similarity index 100% rename from patches/unapplied/server/Add-methods-to-get-translation-keys.patch rename to patches/server/Add-methods-to-get-translation-keys.patch diff --git a/patches/unapplied/server/Add-moon-phase-API.patch b/patches/server/Add-moon-phase-API.patch similarity index 100% rename from patches/unapplied/server/Add-moon-phase-API.patch rename to patches/server/Add-moon-phase-API.patch diff --git a/patches/unapplied/server/Add-more-Evoker-API.patch b/patches/server/Add-more-Evoker-API.patch similarity index 100% rename from patches/unapplied/server/Add-more-Evoker-API.patch rename to patches/server/Add-more-Evoker-API.patch diff --git a/patches/unapplied/server/Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/server/Add-playPickupItemAnimation-to-LivingEntity.patch similarity index 100% rename from patches/unapplied/server/Add-playPickupItemAnimation-to-LivingEntity.patch rename to patches/server/Add-playPickupItemAnimation-to-LivingEntity.patch diff --git a/patches/unapplied/server/Add-setMaxPlayers-API.patch b/patches/server/Add-setMaxPlayers-API.patch similarity index 100% rename from patches/unapplied/server/Add-setMaxPlayers-API.patch rename to patches/server/Add-setMaxPlayers-API.patch diff --git a/patches/unapplied/server/Add-zombie-targets-turtle-egg-config.patch b/patches/server/Add-zombie-targets-turtle-egg-config.patch similarity index 100% rename from patches/unapplied/server/Add-zombie-targets-turtle-egg-config.patch rename to patches/server/Add-zombie-targets-turtle-egg-config.patch diff --git a/patches/unapplied/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch b/patches/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch similarity index 80% rename from patches/unapplied/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch rename to patches/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch index cb8a4276c0..4f8f7d3d23 100644 --- a/patches/unapplied/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch +++ b/patches/server/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch @@ -15,32 +15,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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); @@ -0,0 +0,0 @@ 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 diff --git a/patches/unapplied/server/Beacon-API-custom-effect-ranges.patch b/patches/server/Beacon-API-custom-effect-ranges.patch similarity index 100% rename from patches/unapplied/server/Beacon-API-custom-effect-ranges.patch rename to patches/server/Beacon-API-custom-effect-ranges.patch diff --git a/patches/unapplied/server/Brand-support.patch b/patches/server/Brand-support.patch similarity index 99% rename from patches/unapplied/server/Brand-support.patch rename to patches/server/Brand-support.patch index cc6d552a8b..e2c9f10f00 100644 --- a/patches/unapplied/server/Brand-support.patch +++ b/patches/server/Brand-support.patch @@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic try { byte[] data = new byte[packet.data.readableBytes()]; diff --git a/patches/unapplied/server/Buffer-joins-to-world.patch b/patches/server/Buffer-joins-to-world.patch similarity index 99% rename from patches/unapplied/server/Buffer-joins-to-world.patch rename to patches/server/Buffer-joins-to-world.patch index 6e51274d45..186dce05a4 100644 --- a/patches/unapplied/server/Buffer-joins-to-world.patch +++ b/patches/server/Buffer-joins-to-world.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { + } } - // Paper end + private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper + private static int joinAttemptsThisTick; // Paper diff --git a/patches/unapplied/server/Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch b/patches/server/Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch similarity index 100% rename from patches/unapplied/server/Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch rename to patches/server/Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch diff --git a/patches/unapplied/server/Cache-block-data-strings.patch b/patches/server/Cache-block-data-strings.patch similarity index 100% rename from patches/unapplied/server/Cache-block-data-strings.patch rename to patches/server/Cache-block-data-strings.patch diff --git a/patches/unapplied/server/Create-HoverEvent-from-ItemStack-Entity.patch b/patches/server/Create-HoverEvent-from-ItemStack-Entity.patch similarity index 100% rename from patches/unapplied/server/Create-HoverEvent-from-ItemStack-Entity.patch rename to patches/server/Create-HoverEvent-from-ItemStack-Entity.patch diff --git a/patches/unapplied/server/Do-not-let-the-server-load-chunks-from-newer-version.patch b/patches/server/Do-not-let-the-server-load-chunks-from-newer-version.patch similarity index 81% rename from patches/unapplied/server/Do-not-let-the-server-load-chunks-from-newer-version.patch rename to patches/server/Do-not-let-the-server-load-chunks-from-newer-version.patch index c5c405cf11..d36c45ea67 100644 --- a/patches/unapplied/server/Do-not-let-the-server-load-chunks-from-newer-version.patch +++ b/patches/server/Do-not-let-the-server-load-chunks-from-newer-version.patch @@ -13,16 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java @@ -0,0 +0,0 @@ public class ChunkSerializer { - return holder.protoChunk; - } + + 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 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + // 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)) { diff --git a/patches/unapplied/server/Don-t-require-FACING-data.patch b/patches/server/Don-t-require-FACING-data.patch similarity index 100% rename from patches/unapplied/server/Don-t-require-FACING-data.patch rename to patches/server/Don-t-require-FACING-data.patch diff --git a/patches/unapplied/server/Eigencraft-redstone-implementation.patch b/patches/server/Eigencraft-redstone-implementation.patch similarity index 100% rename from patches/unapplied/server/Eigencraft-redstone-implementation.patch rename to patches/server/Eigencraft-redstone-implementation.patch diff --git a/patches/unapplied/server/Entity-isTicking.patch b/patches/server/Entity-isTicking.patch similarity index 100% rename from patches/unapplied/server/Entity-isTicking.patch rename to patches/server/Entity-isTicking.patch diff --git a/patches/unapplied/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch similarity index 100% rename from patches/unapplied/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch rename to patches/server/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch diff --git a/patches/unapplied/server/Extend-block-drop-capture-to-capture-all-items-added.patch b/patches/server/Extend-block-drop-capture-to-capture-all-items-added.patch similarity index 100% rename from patches/unapplied/server/Extend-block-drop-capture-to-capture-all-items-added.patch rename to patches/server/Extend-block-drop-capture-to-capture-all-items-added.patch diff --git a/patches/unapplied/server/Fix-Concurrency-issue-in-ShufflingList.patch b/patches/server/Fix-Concurrency-issue-in-ShufflingList.patch similarity index 100% rename from patches/unapplied/server/Fix-Concurrency-issue-in-ShufflingList.patch rename to patches/server/Fix-Concurrency-issue-in-ShufflingList.patch diff --git a/patches/unapplied/server/Fix-CraftTeam-null-check.patch b/patches/server/Fix-CraftTeam-null-check.patch similarity index 100% rename from patches/unapplied/server/Fix-CraftTeam-null-check.patch rename to patches/server/Fix-CraftTeam-null-check.patch diff --git a/patches/unapplied/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch similarity index 100% rename from patches/unapplied/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch rename to patches/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch diff --git a/patches/unapplied/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch similarity index 100% rename from patches/unapplied/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch rename to patches/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch diff --git a/patches/unapplied/server/Fix-client-lag-on-advancement-loading.patch b/patches/server/Fix-client-lag-on-advancement-loading.patch similarity index 100% rename from patches/unapplied/server/Fix-client-lag-on-advancement-loading.patch rename to patches/server/Fix-client-lag-on-advancement-loading.patch diff --git a/patches/unapplied/server/Fix-deop-kicking-non-whitelisted-player-when-white-l.patch b/patches/server/Fix-deop-kicking-non-whitelisted-player-when-white-l.patch similarity index 100% rename from patches/unapplied/server/Fix-deop-kicking-non-whitelisted-player-when-white-l.patch rename to patches/server/Fix-deop-kicking-non-whitelisted-player-when-white-l.patch diff --git a/patches/unapplied/server/Fix-for-large-move-vectors-crashing-server.patch b/patches/server/Fix-for-large-move-vectors-crashing-server.patch similarity index 83% rename from patches/unapplied/server/Fix-for-large-move-vectors-crashing-server.patch rename to patches/server/Fix-for-large-move-vectors-crashing-server.patch index 58915421d8..071b23ea1e 100644 --- a/patches/unapplied/server/Fix-for-large-move-vectors-crashing-server.patch +++ b/patches/server/Fix-for-large-move-vectors-crashing-server.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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)); + if (entity instanceof LivingEntity) { @@ -0,0 +0,0 @@ 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; + 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) { + if (d10 > 1.0D) { @@ -0,0 +0,0 @@ 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) { diff --git a/patches/unapplied/server/Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch similarity index 100% rename from patches/unapplied/server/Fix-hex-colors-not-working-in-some-kick-messages.patch rename to patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch diff --git a/patches/unapplied/server/Fix-item-locations-dropped-from-campfires.patch b/patches/server/Fix-item-locations-dropped-from-campfires.patch similarity index 100% rename from patches/unapplied/server/Fix-item-locations-dropped-from-campfires.patch rename to patches/server/Fix-item-locations-dropped-from-campfires.patch diff --git a/patches/unapplied/server/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch b/patches/server/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch similarity index 100% rename from patches/unapplied/server/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch rename to patches/server/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch diff --git a/patches/unapplied/server/Fix-some-rails-connecting-improperly.patch b/patches/server/Fix-some-rails-connecting-improperly.patch similarity index 100% rename from patches/unapplied/server/Fix-some-rails-connecting-improperly.patch rename to patches/server/Fix-some-rails-connecting-improperly.patch diff --git a/patches/unapplied/server/Fixed-TileEntityBell-memory-leak.patch b/patches/server/Fixed-TileEntityBell-memory-leak.patch similarity index 100% rename from patches/unapplied/server/Fixed-TileEntityBell-memory-leak.patch rename to patches/server/Fixed-TileEntityBell-memory-leak.patch diff --git a/patches/unapplied/server/Item-no-age-no-player-pickup.patch b/patches/server/Item-no-age-no-player-pickup.patch similarity index 100% rename from patches/unapplied/server/Item-no-age-no-player-pickup.patch rename to patches/server/Item-no-age-no-player-pickup.patch diff --git a/patches/unapplied/server/Lazily-track-plugin-scoreboards-by-default.patch b/patches/server/Lazily-track-plugin-scoreboards-by-default.patch similarity index 100% rename from patches/unapplied/server/Lazily-track-plugin-scoreboards-by-default.patch rename to patches/server/Lazily-track-plugin-scoreboards-by-default.patch diff --git a/patches/unapplied/server/Optimise-getType-calls.patch b/patches/server/Optimise-getType-calls.patch similarity index 100% rename from patches/unapplied/server/Optimise-getType-calls.patch rename to patches/server/Optimise-getType-calls.patch diff --git a/patches/unapplied/server/Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch b/patches/server/Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch similarity index 100% rename from patches/unapplied/server/Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch rename to patches/server/Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch diff --git a/patches/unapplied/server/Player-elytra-boost-API.patch b/patches/server/Player-elytra-boost-API.patch similarity index 100% rename from patches/unapplied/server/Player-elytra-boost-API.patch rename to patches/server/Player-elytra-boost-API.patch diff --git a/patches/unapplied/server/PortalCreateEvent-needs-to-know-its-entity.patch b/patches/server/PortalCreateEvent-needs-to-know-its-entity.patch similarity index 100% rename from patches/unapplied/server/PortalCreateEvent-needs-to-know-its-entity.patch rename to patches/server/PortalCreateEvent-needs-to-know-its-entity.patch diff --git a/patches/unapplied/server/Prevent-headless-pistons-from-being-created.patch b/patches/server/Prevent-headless-pistons-from-being-created.patch similarity index 100% rename from patches/unapplied/server/Prevent-headless-pistons-from-being-created.patch rename to patches/server/Prevent-headless-pistons-from-being-created.patch diff --git a/patches/unapplied/server/Reduce-blockpos-allocation-from-pathfinding.patch b/patches/server/Reduce-blockpos-allocation-from-pathfinding.patch similarity index 86% rename from patches/unapplied/server/Reduce-blockpos-allocation-from-pathfinding.patch rename to patches/server/Reduce-blockpos-allocation-from-pathfinding.patch index 0c0389a8ce..e3b2a57db7 100644 --- a/patches/unapplied/server/Reduce-blockpos-allocation-from-pathfinding.patch +++ b/patches/server/Reduce-blockpos-allocation-from-pathfinding.patch @@ -16,13 +16,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (blockState.getFluidState().is(FluidTags.WATER)) { return BlockPathTypes.WATER_BORDER; } - } // Paper + @@ -0,0 +0,0 @@ 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)) { diff --git a/patches/unapplied/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch b/patches/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch similarity index 86% rename from patches/unapplied/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch rename to patches/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch index 8f8cfb253a..ca10588561 100644 --- a/patches/unapplied/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch +++ b/patches/server/Reset-Ender-Crystals-on-Dragon-Spawn.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java @@ -0,0 +0,0 @@ public class EndDragonFight { - enderDragon.moveTo(0.0D, 128.0D, 0.0D, this.level.random.nextFloat() * 360.0F, 0.0F); + 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 diff --git a/patches/unapplied/server/Retain-block-place-order-when-capturing-blockstates.patch b/patches/server/Retain-block-place-order-when-capturing-blockstates.patch similarity index 100% rename from patches/unapplied/server/Retain-block-place-order-when-capturing-blockstates.patch rename to patches/server/Retain-block-place-order-when-capturing-blockstates.patch diff --git a/patches/unapplied/server/Toggle-for-removing-existing-dragon.patch b/patches/server/Toggle-for-removing-existing-dragon.patch similarity index 100% rename from patches/unapplied/server/Toggle-for-removing-existing-dragon.patch rename to patches/server/Toggle-for-removing-existing-dragon.patch diff --git a/patches/unapplied/server/Villager-resetOffers.patch b/patches/server/Villager-resetOffers.patch similarity index 100% rename from patches/unapplied/server/Villager-resetOffers.patch rename to patches/server/Villager-resetOffers.patch