[1.18.x] Fix ContextNbtProvider serializing the wrong name (#8575)

This commit is contained in:
SizableShrimp authored and GitHub committed 2022-05-03 20:27:37 +01:00
1 parent 9db0d72232
commit f938051373
2 files changed
+23

No files matched your search

@@ -66,3 +66,15 @@
}
}
}
@@ -230,6 +_,11 @@
public LootContextParam<? extends Entity> 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_) {
@@ -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<LootContextParam<?>> m_142524_() {