geforkt von Mirrors/Paper
fix some issues on the todo list
Dieser Commit ist enthalten in:
Ursprung
8a37019dc2
Commit
a55b0c8097
@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ static Codec<HoverEvent.ShowItem> showItemCodec(final Codec<Component> 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()));
|
||||
|
@ -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<ServerPlayer> 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
|
||||
|
@ -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);
|
||||
+ }
|
||||
+ }
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren