From babd22019c9f502d72abeff7dc1c09cefdfe16a8 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Wed, 24 Apr 2024 08:11:27 -0400 Subject: [PATCH] Patches! --- .../server/Add-BellRingEvent.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 ...Add-zombie-targets-turtle-egg-config.patch | 0 .../server/Brand-support.patch | 2 +- .../server/Buffer-joins-to-world.patch | 7 +--- .../server/Cache-block-data-strings.patch | 0 ...ate-HoverEvent-from-ItemStack-Entity.patch | 0 ...erver-load-chunks-from-newer-version.patch | 0 .../server/Don-t-require-FACING-data.patch | 0 ...ortation-and-cancel-velocity-if-tele.patch | 0 ...geEvent-not-firing-for-all-use-cases.patch | 18 ++++----- ...rs-not-working-in-some-kick-messages.patch | 24 ++++++------ ...istake-in-CB-NBT-int-deserialization.patch | 0 ...Fix-some-rails-connecting-improperly.patch | 0 ...CreateEvent-needs-to-know-its-entity.patch | 38 ++++++++++++------- ...-headless-pistons-from-being-created.patch | 0 19 files changed, 48 insertions(+), 41 deletions(-) rename patches/{unapplied => }/server/Add-BellRingEvent.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-zombie-targets-turtle-egg-config.patch (100%) rename patches/{unapplied => }/server/Brand-support.patch (98%) rename patches/{unapplied => }/server/Buffer-joins-to-world.patch (89%) 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 (100%) rename patches/{unapplied => }/server/Don-t-require-FACING-data.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 (71%) rename patches/{unapplied => }/server/Fix-hex-colors-not-working-in-some-kick-messages.patch (70%) 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/PortalCreateEvent-needs-to-know-its-entity.patch (73%) rename patches/{unapplied => }/server/Prevent-headless-pistons-from-being-created.patch (100%) 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-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-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/Brand-support.patch b/patches/server/Brand-support.patch similarity index 98% rename from patches/unapplied/server/Brand-support.patch rename to patches/server/Brand-support.patch index fb7081f111..292defc774 100644 --- a/patches/unapplied/server/Brand-support.patch +++ b/patches/server/Brand-support.patch @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.player.clientBrandName = brandPayload.brand(); + } + // Paper end - Brand support - if (!(packet.payload() instanceof ServerboundCustomPayloadPacket.UnknownPayload)) { + if (!(packet.payload() instanceof DiscardedPayload)) { return; } @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack diff --git a/patches/unapplied/server/Buffer-joins-to-world.patch b/patches/server/Buffer-joins-to-world.patch similarity index 89% rename from patches/unapplied/server/Buffer-joins-to-world.patch rename to patches/server/Buffer-joins-to-world.patch index fa1c8179e6..b974e8eda2 100644 --- a/patches/unapplied/server/Buffer-joins-to-world.patch +++ b/patches/server/Buffer-joins-to-world.patch @@ -28,16 +28,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - Buffer joins to world PacketListener packetlistener = this.packetListener; - if (packetlistener instanceof TickablePacketListener) { - TickablePacketListener tickablepacketlistener = (TickablePacketListener) packetlistener; - + if (packetlistener instanceof TickablePacketListener tickablepacketlistener) { + // 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 - Buffer joins to world ++ } // Paper end - Buffer joins to world } if (!this.isConnected() && !this.disconnectionHandled) { 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 100% 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 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/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 71% 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 index b262f3c906..35c710dade 100644 --- 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 @@ -9,17 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - public void setDefaultSpawnPos(BlockPos pos, float angle) { - // Paper start - Configurable Keep Spawn Loaded range per world - BlockPos prevSpawn = this.getSharedSpawnPos(); -+ Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper - Call SpawnChangeEvent - //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); + float f1 = this.levelData.getSpawnAngle(); + + if (!blockposition1.equals(pos) || f1 != angle) { ++ org.bukkit.Location prevSpawnLoc = this.getWorld().getSpawnLocation(); // Paper - Call SpawnChangeEvent + this.levelData.setSpawn(pos, angle); ++ new org.bukkit.event.world.SpawnChangeEvent(this.getWorld(), prevSpawnLoc).callEvent(); // Paper - Call SpawnChangeEvent + this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle)); + } - this.levelData.setSpawn(pos, angle); -+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 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 70% 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 index 9b8dbc5c18..19134d53e2 100644 --- 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 @@ -9,25 +9,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - } - // CraftBukkit end - if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) { -- MutableComponent ichatmutablecomponent; + } + // CraftBukkit end + if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) { +- MutableComponent ichatmutablecomponent; + net.kyori.adventure.text.Component adventureComponent; // Paper - Fix hex colors not working in some kick messages - if (packet.protocolVersion() < SharedConstants.getCurrentVersion().getProtocolVersion()) { // Spigot - SPIGOT-7546: Handle version check correctly for outdated client message -- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot + if (packet.protocolVersion() < SharedConstants.getCurrentVersion().getProtocolVersion()) { // Spigot - SPIGOT-7546: Handle version check correctly for outdated client message +- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot + adventureComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(java.text.MessageFormat.format(org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName())); // Spigot // Paper - Fix hex colors not working in some kick messages - } else { -- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot + } else { +- ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot + 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 - Fix hex colors not working in some kick messages + - this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent)); - this.connection.disconnect(ichatmutablecomponent); - } else { + this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent)); + this.connection.disconnect(ichatmutablecomponent); + } else { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java 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/PortalCreateEvent-needs-to-know-its-entity.patch b/patches/server/PortalCreateEvent-needs-to-know-its-entity.patch similarity index 73% rename from patches/unapplied/server/PortalCreateEvent-needs-to-know-its-entity.patch rename to patches/server/PortalCreateEvent-needs-to-know-its-entity.patch index 24783370fd..deae9712cf 100644 --- a/patches/unapplied/server/PortalCreateEvent-needs-to-know-its-entity.patch +++ b/patches/server/PortalCreateEvent-needs-to-know-its-entity.patch @@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -0,0 +0,0 @@ public final class ItemStack { +@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder { net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition); if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically -- block.getBlock().onPlace(block, world, newblockposition, oldBlock, true); -+ block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, context); // Paper - pass context +- block.onPlace(world, newblockposition, oldBlock, true); ++ block.onPlace(world, newblockposition, oldBlock, true, context); // Paper - pass context } world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point @@ -24,13 +24,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class BaseFireBlock extends Block { @Override - public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { + protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { + // Paper start - UseOnContext param + this.onPlace(state, world, pos, oldState, notify, null); + } + + @Override -+ public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) { ++ protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) { + // Paper end - UseOnContext param if (!oldState.is(state.getBlock())) { if (BaseFireBlock.inPortalDimension(world)) { @@ -50,12 +50,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -- public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { +- protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { - super.onPlace(state, world, pos, oldState, notify); + // Paper start - UseOnContext param -+ public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) { ++ protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) { + super.onPlace(state, world, pos, oldState, notify, context); -+ // Paper end - UseOnContext param ++ // Paper end - UseOnContext param world.scheduleTick(pos, (Block) this, FireBlock.getFireTickDelay(world.random)); } @@ -68,15 +68,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Paper start - UseOnContext param -+ @Deprecated -+ public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) { ++ protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, net.minecraft.world.item.context.UseOnContext context) { + this.onPlace(state, world, pos, oldState, notify); + } + // Paper end - UseOnContext param + - /** @deprecated */ - @Deprecated - public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { + protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { + org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot + } +@@ -0,0 +0,0 @@ public abstract class BlockBehaviour implements FeatureElement { + this.getBlock().updateIndirectNeighbourShapes(this.asState(), world, pos, flags, maxUpdateDepth); + } + ++ // Paper start ++ public void onPlace(Level world, BlockPos pos, BlockState state, boolean notify, net.minecraft.world.item.context.UseOnContext context) { ++ this.getBlock().onPlace(this.asState(), world, pos, state, notify, context); ++ } ++ // Paper end ++ + public void onPlace(Level world, BlockPos pos, BlockState state, boolean notify) { + this.getBlock().onPlace(this.asState(), world, pos, state, 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java 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