diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/RegistryDataRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/RegistryDataRewriter.java index 0e8ad5482..a364b349a 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/RegistryDataRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/RegistryDataRewriter.java @@ -59,6 +59,8 @@ public class RegistryDataRewriter { key = Key.stripMinecraftNamespace(key); if (key.equals("enchantment")) { updateEnchantments(entries); + } else if (key.equals("trim_material")) { + updateTrimMaterials(entries); } final List toAdd = this.toAdd.get(key); @@ -126,6 +128,22 @@ public class RegistryDataRewriter { } } + public void updateTrimMaterials(final RegistryEntry[] entries) { + if (protocol.getMappingData().getFullItemMappings() == null) { + return; + } + + for (final RegistryEntry entry : entries) { + if (entry.tag() == null) { + continue; + } + + final StringTag ingredientTag = ((CompoundTag) entry.tag()).getStringTag("ingredient"); + final String mappedIngredient = protocol.getMappingData().getFullItemMappings().mappedIdentifier(ingredientTag.getValue()); + ingredientTag.setValue(mappedIngredient); + } + } + private void updateNestedEffect(final CompoundTag effectsTag) { final CompoundTag effect = effectsTag.getCompoundTag("effect"); if (effect == null) {