diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index d132494f6..9f8b6531d 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -4300,7 +4300,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) { final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef); - if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) { -+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && org.apache.commons.lang.ArrayUtils.contains(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc)) { ++ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) { continue dancing; } } diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index bd800da12..3aa78d92b 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -2060,7 +2060,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public void name(net.kyori.adventure.text.Component name) { -+ getSnapshot().getCommandBlock().setName(name == null ? new net.minecraft.network.chat.TextComponent("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name)); ++ getSnapshot().getCommandBlock().setName(name == null ? net.minecraft.network.chat.Component.literal("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name)); + } + // Paper end } @@ -2222,7 +2222,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (i < lines.size() && lines.get(i) != null) { + components[i] = io.papermc.paper.adventure.PaperAdventure.asVanilla(lines.get(i)); + } else { -+ components[i] = new TextComponent(""); ++ components[i] = net.minecraft.network.chat.Component.literal(""); + } + } + return components; @@ -2726,10 +2726,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) { + if (getHandle().connection == null) return; + // TODO this needs to be checked -+ final net.minecraft.core.Registry chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.Registry.CHAT_TYPE_REGISTRY); ++ final net.minecraft.core.Registry chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.Registry.CHAT_TYPE_REGISTRY); + final net.minecraft.network.protocol.Packet packet; + if (identity.equals(net.kyori.adventure.identity.Identity.nil()) || type == net.kyori.adventure.audience.MessageType.SYSTEM) { -+ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(ChatType.SYSTEM))); ++ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(net.minecraft.network.chat.ChatType.SYSTEM))); + } else { + final @Nullable Player source = this.getServer().getPlayer(identity.uuid()); + final ChatSender sender; @@ -2738,7 +2738,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } else { + sender = new ChatSender(identity.uuid(), Component.empty(), null); + } -+ packet = new net.minecraft.network.protocol.game.ClientboundPlayerChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(ChatType.CHAT)), sender, java.time.Instant.now()); ++ packet = new net.minecraft.network.protocol.game.ClientboundPlayerChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(net.minecraft.network.chat.ChatType.CHAT)), sender, java.time.Instant.now()); + } + this.getHandle().connection.send(packet); + } diff --git a/patches/server/Eigencraft-redstone-implementation.patch b/patches/server/Eigencraft-redstone-implementation.patch index dc7fa21a3..aa3a3120e 100644 --- a/patches/server/Eigencraft-redstone-implementation.patch +++ b/patches/server/Eigencraft-redstone-implementation.patch @@ -1139,7 +1139,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!world.isClientSide) { if (state.canSurvive(world, pos)) { - this.updatePowerStrength(world, pos, state); -+ this.updateSurroundingRedstone(world, pos, state, fromPos); // Paper - Optimize redstone ++ this.updateSurroundingRedstone(world, pos, state, sourcePos); // Paper - Optimize redstone } else { dropResources(state, world, pos); world.removeBlock(pos, false); diff --git a/patches/server/Limit-recipe-packets.patch b/patches/server/Limit-recipe-packets.patch index b32798ffa..6c7d31abc 100644 --- a/patches/server/Limit-recipe-packets.patch +++ b/patches/server/Limit-recipe-packets.patch @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + if (!org.bukkit.Bukkit.isPrimaryThread()) { + if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { -+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper ++ server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper + return; + } + } diff --git a/patches/server/Optimize-NetworkManager-Exception-Handling.patch b/patches/server/Optimize-NetworkManager-Exception-Handling.patch index 7decb372d..a87337a51 100644 --- a/patches/server/Optimize-NetworkManager-Exception-Handling.patch +++ b/patches/server/Optimize-NetworkManager-Exception-Handling.patch @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - - PacketUtils.LOGGER.error("Failed to handle packet {}, suppressing error", packet, exception); -+ net.minecraft.network.chat.TextComponent error = new net.minecraft.network.chat.TextComponent("Packet processing error"); ++ net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error"); + networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> { + networkmanager.disconnect(error); + }); diff --git a/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch index 8481f0dbc..e1badec63 100644 --- a/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch +++ b/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch @@ -9,14 +9,6 @@ diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -0,0 +0,0 @@ import net.minecraft.ReportedException; - import net.minecraft.core.NonNullList; - import net.minecraft.core.Registry; - import net.minecraft.network.chat.Component; -+import net.minecraft.network.chat.TextComponent; - import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket; - import net.minecraft.server.level.ServerPlayer; - import net.minecraft.util.Mth; @@ -0,0 +0,0 @@ public abstract class AbstractContainerMenu { } private Component title; @@ -25,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - return chat component with empty text instead of throwing error + // Preconditions.checkState(this.title != null, "Title not set"); + if(this.title == null){ -+ return new TextComponent(""); ++ return Component.literal(""); + } + // Paper end return this.title; diff --git a/patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch index 7080a9b5a..ecc4b5224 100644 --- a/patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -9,14 +9,6 @@ diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -0,0 +0,0 @@ import net.minecraft.network.chat.ClickEvent; - import net.minecraft.network.chat.Component; - import net.minecraft.network.chat.MutableComponent; - import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket; -+import net.minecraft.network.protocol.game.ClientboundSoundPacket; - import net.minecraft.network.syncher.EntityDataAccessor; - import net.minecraft.network.syncher.EntityDataSerializers; - import net.minecraft.network.syncher.SynchedEntityData; @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { int i = b0 + EnchantmentHelper.getKnockbackBonus(this); @@ -71,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { + fromEntity.level.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself + if (fromEntity instanceof ServerPlayer) { -+ ((ServerPlayer) fromEntity).connection.send(new ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch)); ++ ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong())); + } + } + // Paper end diff --git a/patches/server/Support-old-UUID-format-for-NBT.patch b/patches/server/Support-old-UUID-format-for-NBT.patch index 4247fbcf2..7c56e75d4 100644 --- a/patches/server/Support-old-UUID-format-for-NBT.patch +++ b/patches/server/Support-old-UUID-format-for-NBT.patch @@ -54,8 +54,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 string = nbt.getString("Name"); } + // Paper start - support string UUID's -+ if (compound.contains("Id", 8)) { -+ uUID = UUID.fromString(compound.getString("Id")); ++ if (nbt.contains("Id", 8)) { ++ uUID = UUID.fromString(nbt.getString("Id")); + } + // Paper end diff --git a/patches/server/Update-itemstack-legacy-name-and-lore.patch b/patches/server/Update-itemstack-legacy-name-and-lore.patch index 6c68a0cef..2d2b17e45 100644 --- a/patches/server/Update-itemstack-legacy-name-and-lore.patch +++ b/patches/server/Update-itemstack-legacy-name-and-lore.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + try { + list.set(index, convert(json)); + } catch (com.google.gson.JsonParseException e) { -+ list.set(index, net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(new TextComponent("")))); ++ list.set(index, net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(net.minecraft.network.chat.Component.literal("")))); + } + } + }