Skip to content

Commit

Permalink
Remove Java custom armor trims when translating item to Bedrock to pr…
Browse files Browse the repository at this point in the history
…event visual issues (#4548)

* Fix (or workaround) armor items with custom armor trims having no texture on bedrock

* Fix armor items with custom trims causing issues on entity models by removing the Trim tag entirely

* Refer to minecraft namespace inline for consistency
  • Loading branch information
eclipseisoffline authored Apr 4, 2024
1 parent 29bd896 commit 1819ed4
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull Compo
if (tag.get("Trim") instanceof CompoundTag trim) {
StringTag material = trim.remove("material");
StringTag pattern = trim.remove("pattern");

// discard custom trim patterns/materials to prevent visual glitches on bedrock
if (!material.getValue().startsWith("minecraft:")
|| !pattern.getValue().startsWith("minecraft:")) {
tag.remove("Trim");
return;
}

// bedrock has an uppercase first letter key, and the value is not namespaced
trim.put(new StringTag("Material", stripNamespace(material.getValue())));
trim.put(new StringTag("Pattern", stripNamespace(pattern.getValue())));
Expand Down

0 comments on commit 1819ed4

Please # to comment.