fix some issues on the todo list
Dieser Commit ist enthalten in:
Ursprung
f6fae41cdf
Commit
cc81668863
@ -14,7 +14,7 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java b/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..afd658635d1243770ecd96d3f274e3c24175b1e1
|
||||
index 0000000000000000000000000000000000000000..8dcedc5f4d4453fd942787dbcb9c757274ec7715
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java
|
||||
@@ -0,0 +1,446 @@
|
||||
@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..afd658635d1243770ecd96d3f274e3c2
|
||||
+
|
||||
+ 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 c81fd3e1108fb0a02f9240263404af2b968c8494..0d9de4c61c7b26a6ff37c12fde629161fd0c3d5a 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/GiveCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java
|
||||
@@ -38,6 +38,7 @@ 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;
|
||||
|
||||
@@ -79,11 +80,11 @@ 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 50c6b668a8e915081007dfd9c9fc1aae179e16c9..a9130dd3097c31d91baaf1405a369881393d42d5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
|
@ -17,7 +17,7 @@ index 3bd13975934e8f61b41c4c08b73ead6e0f45ffac..bcf4e77ed17fa35d509b33568793a382
|
||||
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
||||
this.stopRiding();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/NeutralMob.java b/src/main/java/net/minecraft/world/entity/NeutralMob.java
|
||||
index 7bb01b28b07bf2b31897cc5ab1f44fc0387958bb..a0d0a3330bb43807172fde1ee21644380517b40c 100644
|
||||
index 7bb01b28b07bf2b31897cc5ab1f44fc0387958bb..1bc49da1c4cc12966ca414152b3ddf7f850c7d44 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/NeutralMob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/NeutralMob.java
|
||||
@@ -42,24 +42,11 @@ public interface NeutralMob {
|
||||
@ -67,12 +67,12 @@ index 7bb01b28b07bf2b31897cc5ab1f44fc0387958bb..a0d0a3330bb43807172fde1ee2164438
|
||||
+
|
||||
+ 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);
|
||||
+ }
|
||||
+ }
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren