diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index cc8b8e46da..6a9f49e81a 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + static Codec showItemCodec(final Codec componentCodec) { + return net.minecraft.network.chat.HoverEvent.ItemStackInfo.CODEC.xmap(isi -> { -+ @Subst("key") final String typeKey = isi.item.unwrapKey().orElseThrow().toString(); ++ @Subst("key") final String typeKey = isi.item.unwrapKey().orElseThrow().location().toString(); + return HoverEvent.ShowItem.showItem(Key.key(typeKey), isi.count, PaperAdventure.asAdventure(isi.getItemStack().getComponentsPatch())); + }, si -> { + final Item itemType = BuiltInRegistries.ITEM.get(PaperAdventure.asVanilla(si.item())); diff --git a/patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch index f4de35c03e..68a88ff463 100644 --- a/patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch +++ b/patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch @@ -4,6 +4,32 @@ Date: Sun, 20 Jun 2021 21:55:59 -0700 Subject: [PATCH] Fix PlayerDropItemEvent using wrong item +diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/commands/GiveCommand.java ++++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java +@@ -0,0 +0,0 @@ public class GiveCommand { + + private static int giveItem(CommandSourceStack source, ItemInput item, Collection targets, int count) throws CommandSyntaxException { + ItemStack itemstack = item.createItemStack(1, false); ++ final Component displayName = itemstack.getDisplayName(); // Paper - get display name early + int j = itemstack.getMaxStackSize(); + int k = j * 100; + +@@ -0,0 +0,0 @@ public class GiveCommand { + + if (targets.size() == 1) { + source.sendSuccess(() -> { +- return Component.translatable("commands.give.success.single", count, itemstack.getDisplayName(), ((ServerPlayer) targets.iterator().next()).getDisplayName()); ++ return Component.translatable("commands.give.success.single", count, displayName, ((ServerPlayer) targets.iterator().next()).getDisplayName()); // Paper - use cached display name + }, true); + } else { + source.sendSuccess(() -> { +- return Component.translatable("commands.give.success.single", count, itemstack.getDisplayName(), targets.size()); ++ return Component.translatable("commands.give.success.single", count, displayName, targets.size()); // Paper - use cached display name + }, true); + } + diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/patches/server/Prevent-entity-loading-causing-async-lookups.patch b/patches/server/Prevent-entity-loading-causing-async-lookups.patch index 7f36832eb7..a8144302b8 100644 --- a/patches/server/Prevent-entity-loading-causing-async-lookups.patch +++ b/patches/server/Prevent-entity-loading-causing-async-lookups.patch @@ -67,12 +67,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if (entity != null) { + if (entity instanceof Mob mob) { -+ this.setTarget(mob); ++ this.setTarget(mob, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); + this.setLastHurtByMob(mob); + } + + if (entity instanceof Player player) { -+ this.setTarget(player); ++ this.setTarget(player, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); + this.setLastHurtByPlayer(player); + } + }