Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ItemStack#displayName only return the display name #9050

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions patches/server/0010-Adventure.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4096,10 +4096,10 @@ index 6a64fbb8b4937f39d5fdc2e2cbec26c83c74c486..7d6b5fdb00a5c1614849735634262a36
public String getTitle() {
return CraftChatMessage.fromComponent(this.container.getTitle());
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index a7ef4a04358df3f848ace0e6e8b6f2d0a18dbc29..4c76692e222d8505558aade9c03b3686612f7c0c 100644
index a7ef4a04358df3f848ace0e6e8b6f2d0a18dbc29..41471ff966ffb0d50831005c397ff56386671431 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -417,4 +417,17 @@ public final class CraftItemFactory implements ItemFactory {
@@ -417,4 +417,22 @@ public final class CraftItemFactory implements ItemFactory {
public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException {
return ((CraftMetaItem) meta).updateMaterial(material);
}
Expand All @@ -4113,7 +4113,12 @@ index a7ef4a04358df3f848ace0e6e8b6f2d0a18dbc29..4c76692e222d8505558aade9c03b3686
+
+ @Override
+ public [email protected] Component displayName(@org.jetbrains.annotations.NotNull ItemStack itemStack) {
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).getDisplayName());
+ net.minecraft.world.item.ItemStack nms = CraftItemStack.asNMSCopy(itemStack);
+ net.minecraft.network.chat.MutableComponent nmsComponent = net.minecraft.network.chat.Component.empty().append(nms.getHoverName());
+ if (nms.hasCustomHoverName()) {
+ nmsComponent.withStyle(net.minecraft.ChatFormatting.ITALIC);
+ }
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(nmsComponent);
+ }
+ // Paper end
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr
to ensure it meets latest minecraft expectations.

diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 4c76692e222d8505558aade9c03b3686612f7c0c..70607c9458f58a05ccc94bfcb38dae79bd7ad483 100644
index 41471ff966ffb0d50831005c397ff56386671431..718e50093850dd0d2e906f0f3e75c73b0e53dcf1 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -429,5 +429,11 @@ public final class CraftItemFactory implements ItemFactory {
public [email protected] Component displayName(@org.jetbrains.annotations.NotNull ItemStack itemStack) {
return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).getDisplayName());
@@ -434,5 +434,11 @@ public final class CraftItemFactory implements ItemFactory {
}
return io.papermc.paper.adventure.PaperAdventure.asAdventure(nmsComponent);
}
+
+ // Paper start
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0150-Implement-getI18NDisplayName.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Currently the server only supports the English language. To override this,
You must replace the language file embedded in the server jar.

diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 70607c9458f58a05ccc94bfcb38dae79bd7ad483..45f37c894a9d862fd9d73908d1dae2e8c62262ff 100644
index 718e50093850dd0d2e906f0f3e75c73b0e53dcf1..6636520985e0186296eb5ae87d590abe57bb81c1 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -435,5 +435,18 @@ public final class CraftItemFactory implements ItemFactory {
@@ -440,5 +440,18 @@ public final class CraftItemFactory implements ItemFactory {
public ItemStack ensureServerConversions(ItemStack item) {
return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Create HoverEvent from ItemStack Entity


diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 45f37c894a9d862fd9d73908d1dae2e8c62262ff..081a92415d8a19da4f342e8febee62c844458cb9 100644
index 6636520985e0186296eb5ae87d590abe57bb81c1..30aac94550d5e6852c9009ffac73783a6ac5e27e 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -448,5 +448,40 @@ public final class CraftItemFactory implements ItemFactory {
@@ -453,5 +453,40 @@ public final class CraftItemFactory implements ItemFactory {

return nms != null ? net.minecraft.locale.Language.getInstance().getOrDefault(nms.getItem().getDescriptionId(nms)) : null;
}
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0684-Add-ItemFactory-getSpawnEgg-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Add ItemFactory#getSpawnEgg API


diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 081a92415d8a19da4f342e8febee62c844458cb9..3c72c95872365a66a19793a613c008720fc681ac 100644
index 30aac94550d5e6852c9009ffac73783a6ac5e27e..bd39f5b27a23e913d1d1f6f781ee43fadf50d52a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -483,5 +483,17 @@ public final class CraftItemFactory implements ItemFactory {
@@ -488,5 +488,17 @@ public final class CraftItemFactory implements ItemFactory {
entity.getUniqueId().toString(),
new net.md_5.bungee.api.chat.TextComponent(customName));
}
Expand Down