From f9380513732131d11aaf9d643ee14681ba1b3d99 Mon Sep 17 00:00:00 2001 From: SizableShrimp Date: Tue, 3 May 2022 14:27:37 -0500 Subject: [PATCH] [1.18.x] Fix ContextNbtProvider serializing the wrong name (#8575) --- .../world/level/storage/loot/LootContext.java.patch | 12 ++++++++++++ .../loot/providers/nbt/ContextNbtProvider.java.patch | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 patches/minecraft/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch index 15cd263cc2..357d390ce0 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch @@ -66,3 +66,15 @@ } } } +@@ -230,6 +_,11 @@ + + public LootContextParam m_79003_() { + return this.f_78995_; ++ } ++ ++ // Forge: This method is patched in to expose the same name used in getByName so that ContextNbtProvider#forEntity serializes it properly ++ public String getName() { ++ return this.f_78994_; + } + + public static LootContext.EntityTarget m_79006_(String p_79007_) { diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch new file mode 100644 index 0000000000..be17438bd4 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java ++++ b/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java +@@ -46,7 +_,7 @@ + } + + public String m_142016_() { +- return p_165578_.name(); ++ return p_165578_.getName(); + } + + public Set> m_142524_() {