From 223e9caa4c2e2bdea4f3960aa99ca2bf8f1ce88a Mon Sep 17 00:00:00 2001 From: Raycoms Date: Tue, 20 Aug 2024 21:32:46 +0200 Subject: [PATCH] fix banner loading spam --- .../com/minecolonies/api/util/constant/NbtTagConstants.java | 4 ++-- .../core/entity/ai/workers/guard/KnightCombatAI.java | 1 - .../core/tileentities/TileEntityColonyFlag.java | 6 +++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/minecolonies/api/util/constant/NbtTagConstants.java b/src/main/java/com/minecolonies/api/util/constant/NbtTagConstants.java index ef680983210..b42194a55b5 100755 --- a/src/main/java/com/minecolonies/api/util/constant/NbtTagConstants.java +++ b/src/main/java/com/minecolonies/api/util/constant/NbtTagConstants.java @@ -458,9 +458,9 @@ public final class NbtTagConstants public static final String TAG_FLAG_PATTERNS = "colonyflag"; /** - * Tag used by vanilla to store banner patterns + * Tag we use to store the patterns. */ - public static final String TAG_BANNER_PATTERNS = "Patterns"; + public static final String TAG_BANNER_PATTERNS = "cbpatterns"; /** * Tag used by vanilla to store a single pattern in banner pattern-color pairs diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/guard/KnightCombatAI.java b/src/main/java/com/minecolonies/core/entity/ai/workers/guard/KnightCombatAI.java index 1399e152a9d..3d426962eb3 100644 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/guard/KnightCombatAI.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/guard/KnightCombatAI.java @@ -40,7 +40,6 @@ import static com.minecolonies.api.research.util.ResearchConstants.*; import static com.minecolonies.api.util.constant.GuardConstants.*; -import static com.minecolonies.api.util.constant.NbtTagConstants.TAG_BANNER_PATTERNS; import static com.minecolonies.api.util.constant.StatisticsConstants.MOBS_KILLED; import static com.minecolonies.api.util.constant.StatisticsConstants.MOB_KILLED; import static com.minecolonies.core.colony.buildings.modules.BuildingModules.STATS_MODULE; diff --git a/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java b/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java index 88380fd9e3b..206213d280e 100644 --- a/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java +++ b/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java @@ -56,7 +56,11 @@ public void loadAdditional(CompoundTag compound, @NotNull final HolderLookup.Pro { super.loadAdditional(compound, provider); - this.patterns = Utils.deserializeCodecMess(BannerPatternLayers.CODEC, provider, compound.get(TAG_BANNER_PATTERNS)); + if (compound.contains(TAG_BANNER_PATTERNS)) + { + this.patterns = Utils.deserializeCodecMess(BannerPatternLayers.CODEC, provider, compound.get(TAG_BANNER_PATTERNS)); + } + this.colonyId = compound.getInt(TAG_COLONY_ID); if(this.colonyId == -1 && this.hasLevel())