diff options
author | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
---|---|---|
committer | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
commit | bee74680e607c2e29b038329f62181238911cd83 (patch) | |
tree | 708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol | |
parent | 0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff) | |
download | Paper-softspoon.tar.gz Paper-softspoon.zip |
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol')
9 files changed, 166 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/PacketUtils.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/PacketUtils.java.patch new file mode 100644 index 0000000000..f2c12852ca --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/PacketUtils.java.patch @@ -0,0 +1,47 @@ +--- a/net/minecraft/network/protocol/PacketUtils.java ++++ b/net/minecraft/network/protocol/PacketUtils.java +@@ -4,8 +4,14 @@ + import net.minecraft.CrashReport; + import net.minecraft.ReportedException; + import net.minecraft.network.PacketListener; +-import net.minecraft.server.RunningOnDifferentThreadException; ++import net.minecraft.server.CancelledPacketHandleException; ++import org.slf4j.Logger; ++ ++// CraftBukkit start ++import net.minecraft.server.MinecraftServer; + import net.minecraft.server.level.ServerLevel; ++import net.minecraft.server.network.ServerCommonPacketListenerImpl; ++// CraftBukkit end + import net.minecraft.util.thread.BlockableEventLoop; + import org.slf4j.Logger; + +@@ -19,10 +24,11 @@ + ensureRunningOnSameThread(packet, t0, (BlockableEventLoop) serverlevel.getServer()); + } + +- public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T t0, BlockableEventLoop<?> blockableeventloop) throws RunningOnDifferentThreadException { +- if (!blockableeventloop.isSameThread()) { +- blockableeventloop.executeIfPossible(() -> { +- if (t0.shouldHandleMessage(packet)) { ++ public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T processor, BlockableEventLoop<?> executor) throws CancelledPacketHandleException { ++ if (!executor.isSameThread()) { ++ executor.executeIfPossible(() -> { ++ if (MinecraftServer.getServer().hasStopped() || (processor instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) processor).processedDisconnect)) return; // CraftBukkit, MC-142590 ++ if (processor.shouldHandleMessage(packet)) { + try { + packet.handle(t0); + } catch (Exception exception) { +@@ -59,7 +65,11 @@ + } + + }); +- throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; ++ throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD; ++ // CraftBukkit start - SPIGOT-5477, MC-142590 ++ } else if (MinecraftServer.getServer().hasStopped() || (processor instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) processor).processedDisconnect)) { ++ throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD; ++ // CraftBukkit end + } + } + } diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch new file mode 100644 index 0000000000..c95bd4e06e --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch @@ -0,0 +1,44 @@ +--- a/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java ++++ b/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java +@@ -12,7 +12,7 @@ + public record ServerboundCustomPayloadPacket(CustomPacketPayload payload) implements Packet<ServerCommonPacketListener> { + + private static final int MAX_PAYLOAD_SIZE = 32767; +- private static final Map<ResourceLocation, FriendlyByteBuf.Reader<? extends CustomPacketPayload>> KNOWN_TYPES = ImmutableMap.builder().put(BrandPayload.ID, BrandPayload::new).build(); ++ private static final Map<ResourceLocation, FriendlyByteBuf.a<? extends CustomPacketPayload>> KNOWN_TYPES = ImmutableMap.<ResourceLocation, FriendlyByteBuf.a<? extends CustomPacketPayload>>builder().build(); // CraftBukkit - no special handling + + public ServerboundCustomPayloadPacket(FriendlyByteBuf friendlybytebuf) { + this(readPayload(friendlybytebuf.readResourceLocation(), friendlybytebuf)); +@@ -24,12 +24,13 @@ + return (CustomPacketPayload) (friendlybytebuf_reader != null ? (CustomPacketPayload) friendlybytebuf_reader.apply(friendlybytebuf) : readUnknownPayload(resourcelocation, friendlybytebuf)); + } + +- private static DiscardedPayload readUnknownPayload(ResourceLocation resourcelocation, FriendlyByteBuf friendlybytebuf) { +- int i = friendlybytebuf.readableBytes(); ++ private static UnknownPayload readUnknownPayload(ResourceLocation minecraftkey, FriendlyByteBuf packetdataserializer) { // CraftBukkit ++ int i = packetdataserializer.readableBytes(); + + if (i >= 0 && i <= 32767) { +- friendlybytebuf.skipBytes(i); +- return new DiscardedPayload(resourcelocation); ++ // CraftBukkit start ++ return new UnknownPayload(minecraftkey, packetdataserializer.readBytes(i)); ++ // CraftBukkit end + } else { + throw new IllegalArgumentException("Payload may not be larger than 32767 bytes"); + } +@@ -46,4 +45,14 @@ + public void handle(ServerCommonPacketListener servercommonpacketlistener) { + servercommonpacketlistener.handleCustomPayload(this); + } ++ ++ // CraftBukkit start ++ public record UnknownPayload(ResourceLocation id, io.netty.buffer.ByteBuf data) implements CustomPacketPayload { ++ ++ @Override ++ public void write(FriendlyByteBuf packetdataserializer) { ++ packetdataserializer.writeBytes(data); ++ } ++ } ++ // CraftBukkit end + } diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java.patch new file mode 100644 index 0000000000..294bfa4ffa --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java ++++ b/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java +@@ -26,15 +26,17 @@ + this.warningTime = friendlybytebuf.readVarInt(); + } + +- public ClientboundInitializeBorderPacket(WorldBorder worldborder) { +- this.newCenterX = worldborder.getCenterX(); +- this.newCenterZ = worldborder.getCenterZ(); +- this.oldSize = worldborder.getSize(); +- this.newSize = worldborder.getLerpTarget(); +- this.lerpTime = worldborder.getLerpRemainingTime(); +- this.newAbsoluteMaxSize = worldborder.getAbsoluteMaxSize(); +- this.warningBlocks = worldborder.getWarningBlocks(); +- this.warningTime = worldborder.getWarningTime(); ++ public ClientboundInitializeBorderPacket(WorldBorder worldBorder) { ++ // CraftBukkit start - multiply out nether border ++ this.newCenterX = worldBorder.getCenterX() * worldBorder.world.dimensionType().coordinateScale(); ++ this.newCenterZ = worldBorder.getCenterZ() * worldBorder.world.dimensionType().coordinateScale(); ++ // CraftBukkit end ++ this.oldSize = worldBorder.getSize(); ++ this.newSize = worldBorder.getLerpTarget(); ++ this.lerpTime = worldBorder.getLerpRemainingTime(); ++ this.newAbsoluteMaxSize = worldBorder.getAbsoluteMaxSize(); ++ this.warningBlocks = worldBorder.getWarningBlocks(); ++ this.warningTime = worldBorder.getWarningTime(); + } + + @Override diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java.patch new file mode 100644 index 0000000000..0f91165711 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java.patch @@ -0,0 +1,25 @@ +--- a/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java ++++ b/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java +@@ -30,14 +30,18 @@ + short short0 = (Short) shortiterator.next(); + + this.positions[j] = short0; +- this.states[j] = levelchunksection.getBlockState(SectionPos.sectionRelativeX(short0), SectionPos.sectionRelativeY(short0), SectionPos.sectionRelativeZ(short0)); ++ this.states[j] = (section != null) ? section.getBlockState(SectionPos.sectionRelativeX(short0), SectionPos.sectionRelativeY(short0), SectionPos.sectionRelativeZ(short0)) : net.minecraft.world.level.block.Blocks.AIR.defaultBlockState(); // CraftBukkit - SPIGOT-6076, Mojang bug when empty chunk section notified + } + + } + +- public ClientboundSectionBlocksUpdatePacket(FriendlyByteBuf friendlybytebuf) { +- this.sectionPos = SectionPos.of(friendlybytebuf.readLong()); +- int i = friendlybytebuf.readVarInt(); ++ // CraftBukkit start - Add constructor ++ public ClientboundSectionBlocksUpdatePacket(SectionPos sectionposition, ShortSet shortset, IBlockData[] states) { ++ this.sectionPos = sectionposition; ++ this.positions = shortset.toShortArray(); ++ this.states = states; ++ } ++ // CraftBukkit end + + this.positions = new short[i]; + this.states = new BlockState[i]; diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java.patch new file mode 100644 index 0000000000..3439ec4759 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java.patch @@ -0,0 +1,17 @@ +--- a/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java ++++ b/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java +@@ -9,9 +9,11 @@ + private final double newCenterX; + private final double newCenterZ; + +- public ClientboundSetBorderCenterPacket(WorldBorder worldborder) { +- this.newCenterX = worldborder.getCenterX(); +- this.newCenterZ = worldborder.getCenterZ(); ++ public ClientboundSetBorderCenterPacket(WorldBorder worldBorder) { ++ // CraftBukkit start - multiply out nether border ++ this.newCenterX = worldBorder.getCenterX() * (worldBorder.world != null ? worldBorder.world.dimensionType().coordinateScale() : 1.0); ++ this.newCenterZ = worldBorder.getCenterZ() * (worldBorder.world != null ? worldBorder.world.dimensionType().coordinateScale() : 1.0); ++ // CraftBukkit end + } + + public ClientboundSetBorderCenterPacket(FriendlyByteBuf friendlybytebuf) { diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java.patch new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java.patch @@ -0,0 +1 @@ + diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ServerboundUseItemOnPacket.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ServerboundUseItemOnPacket.java.patch new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ServerboundUseItemOnPacket.java.patch @@ -0,0 +1 @@ + diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ServerboundUseItemPacket.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ServerboundUseItemPacket.java.patch new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/game/ServerboundUseItemPacket.java.patch @@ -0,0 +1 @@ + diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java.patch new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/handshake/ClientIntentionPacket.java.patch @@ -0,0 +1 @@ + |