From fc17b7cc7a50c1d330c2498a68abffdc9d345505 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Mon, 27 Apr 2020 02:01:15 -0500 Subject: [PATCH] Disabled attempted rendering of the globe pattern --- .../entity/BannerBlockEntityTranslator.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/block/entity/BannerBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/block/entity/BannerBlockEntityTranslator.java index 22d26cb4b..e81191a39 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/block/entity/BannerBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/block/entity/BannerBlockEntityTranslator.java @@ -56,7 +56,10 @@ public class BannerBlockEntityTranslator extends BlockEntityTranslator implement List tagsList = new ArrayList<>(); if (tag.contains("Patterns")) { for (com.github.steveice10.opennbt.tag.builtin.Tag patternTag : patterns.getValue()) { - tagsList.add(getPattern((CompoundTag) patternTag)); + com.nukkitx.nbt.tag.CompoundTag newPatternTag = getPattern((CompoundTag) patternTag); + if (newPatternTag != null) { + tagsList.add(newPatternTag); + } } com.nukkitx.nbt.tag.ListTag bedrockPatterns = new com.nukkitx.nbt.tag.ListTag<>("Patterns", com.nukkitx.nbt.tag.CompoundTag.class, tagsList); @@ -82,10 +85,24 @@ public class BannerBlockEntityTranslator extends BlockEntityTranslator implement return tagBuilder.buildRootTag(); } + /** + * Convert the Java edition pattern nbt to Bedrock edition, null if the pattern doesn't exist + * + * @param pattern Java edition pattern nbt + * @return The Bedrock edition format pattern nbt + */ protected com.nukkitx.nbt.tag.CompoundTag getPattern(CompoundTag pattern) { + String patternName = (String) pattern.get("Pattern").getValue(); + + // Return null if its the globe pattern as it doesn't exist on bedrock + if (patternName.equals("glb")) { + return null; + } + return CompoundTagBuilder.builder() .intTag("Color", 15 - (int) pattern.get("Color").getValue()) .stringTag("Pattern", (String) pattern.get("Pattern").getValue()) + .stringTag("Pattern", patternName) .buildRootTag(); } }