From f6b0dae34df61b43e5936fe935bdb9a674dd3514 Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Mon, 2 Dec 2024 21:13:19 +0100 Subject: [PATCH 01/12] Remove duplication of flag --- .../core/tileentities/TileEntityColonyFlag.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java b/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java index e57afd8b5dc..e0440c39352 100644 --- a/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java +++ b/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java @@ -28,9 +28,6 @@ public class TileEntityColonyFlag extends BlockEntity { - /** The last known flag. Required for when the colony is not available. */ - private ListTag flag = new ListTag(); - /** A list of the default banner patterns, for colonies that have not chosen a flag */ private ListTag patterns = new ListTag(); @@ -44,7 +41,6 @@ public void saveAdditional(CompoundTag compound) { super.saveAdditional(compound); - compound.put(TAG_FLAG_PATTERNS, this.flag); compound.put(TAG_BANNER_PATTERNS, this.patterns); compound.putInt(TAG_COLONY_ID, colonyId); @@ -55,7 +51,6 @@ public void load(CompoundTag compound) { super.load(compound); - this.flag = compound.getList(TAG_FLAG_PATTERNS, 10); this.patterns = compound.getList(TAG_BANNER_PATTERNS, 10); this.colonyId = compound.getInt(TAG_COLONY_ID); @@ -97,16 +92,16 @@ public List, DyeColor>> getPatternList() if (level != null && level.dimension() != null) { IColonyView colony = IColonyManager.getInstance().getColonyView(this.colonyId, level.dimension()); - if (colony != null && this.flag != colony.getColonyFlag()) + if (colony != null && this.patterns != colony.getColonyFlag()) { - this.flag = colony.getColonyFlag(); + this.patterns = colony.getColonyFlag(); setChanged(); } } return BannerBlockEntity.createPatterns( DyeColor.WHITE, - this.flag.size() > 1 ? this.flag : this.patterns + this.patterns ); } From 4b9a1b5767e7a386ea4b567df72567b15b057181 Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Mon, 2 Dec 2024 21:23:05 +0100 Subject: [PATCH 02/12] Rename getPatterns to be similar to vanilia --- .../core/client/render/TileEntityColonyFlagRenderer.java | 2 +- .../core/tileentities/TileEntityColonyFlag.java | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/minecolonies/core/client/render/TileEntityColonyFlagRenderer.java b/src/main/java/com/minecolonies/core/client/render/TileEntityColonyFlagRenderer.java index 64a67ddf7b8..b44078c68cb 100644 --- a/src/main/java/com/minecolonies/core/client/render/TileEntityColonyFlagRenderer.java +++ b/src/main/java/com/minecolonies/core/client/render/TileEntityColonyFlagRenderer.java @@ -53,7 +53,7 @@ public TileEntityColonyFlagRenderer(final BlockEntityRendererProvider.Context co @Override public void render(TileEntityColonyFlag flagIn, float partialTicks, PoseStack transform, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { - List, DyeColor>> list = flagIn.getPatternList(); + List, DyeColor>> list = flagIn.getPatterns(); boolean noWorld = flagIn.getLevel() == null; transform.pushPose(); diff --git a/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java b/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java index e0440c39352..bec4dcf9e34 100644 --- a/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java +++ b/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java @@ -82,11 +82,10 @@ public void onDataPacket(final Connection net, final ClientboundBlockEntityDataP } /** - * Retrieves the patterns for the renderer + * Retrieves the patterns, similar to {@link BannerBlockEntity#getPatterns()} * @return the list of pattern-color pairs */ - @OnlyIn(Dist.CLIENT) - public List, DyeColor>> getPatternList() + public List, DyeColor>> getPatterns() { // Structurize will cause the second condition to be false if (level != null && level.dimension() != null) @@ -113,7 +112,7 @@ public List, DyeColor>> getPatternList() public ItemStack getItemClient() { ItemStack itemstack = new ItemStack(ModBlocks.blockColonyBanner); - List, DyeColor>> list = getPatternList(); + List, DyeColor>> list = getPatterns(); ListTag nbt = new ListTag(); for (Pair, DyeColor> pair : list) From 549a2821df2b7df59b915beed3dd254af2b36003 Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Mon, 2 Dec 2024 21:34:40 +0100 Subject: [PATCH 03/12] Fix client crash when copy vanilia banner --- .../core/items/ItemColonyFlagBanner.java | 50 ++++++++----------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java index cc862589ddd..81a852145e4 100644 --- a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java +++ b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java @@ -2,17 +2,22 @@ import com.minecolonies.api.blocks.ModBlocks; import com.minecolonies.core.tileentities.TileEntityColonyFlag; +import com.mojang.datafixers.util.Pair; + import net.minecraft.world.level.block.AbstractBannerBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BannerPatterns; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.BannerItem; +import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.core.Holder; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.world.level.block.entity.BannerBlockEntity; +import net.minecraft.world.level.block.entity.BannerPattern; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.InteractionResult; import net.minecraft.network.chat.Component; @@ -46,39 +51,24 @@ public InteractionResult useOn(UseOnContext context) { // Duplicate the patterns of the banner that was clicked on BlockEntity te = context.getLevel().getBlockEntity(context.getClickedPos()); - BlockState state = context.getLevel().getBlockState(context.getClickedPos()); - ItemStack stack = context.getPlayer().getMainHandItem(); + ItemStack stack = context.getItemInHand(); if (te instanceof BannerBlockEntity || te instanceof TileEntityColonyFlag) { - CompoundTag source; - if (te instanceof BannerBlockEntity) - { - source = ((BannerBlockEntity) te).getItem() - .getTag().getCompound("BlockEntityTag"); - } - else - { - source = (context.getLevel().isClientSide ? ((TileEntityColonyFlag) te).getItemClient() : ((TileEntityColonyFlag) te).getItemServer()) - .getTag().getCompound("BlockEntityTag"); - } - - ListTag patternList = source.getList(TAG_BANNER_PATTERNS, 10); - - // Set the base pattern, if there wasn't one set. - // This saves us attempting to alter the item itself to change the base color. - if (!patternList.getCompound(0).getString(TAG_SINGLE_PATTERN).equals(BannerPatterns.BASE.location().toString())) - { - CompoundTag nbt = new CompoundTag(); - nbt.putString(TAG_SINGLE_PATTERN, BannerPatterns.BASE.location().toString()); - nbt.putInt(TAG_PATTERN_COLOR, ((AbstractBannerBlock) state.getBlock()).getColor().getId()); - patternList.add(0, nbt); - } - - CompoundTag tag = stack.getOrCreateTagElement("BlockEntityTag"); - tag.put(TAG_BANNER_PATTERNS, patternList); - - return InteractionResult.SUCCESS; + BannerPattern.Builder patternsBuilder = new BannerPattern.Builder(); + List, DyeColor>> source; + + if (te instanceof BannerBlockEntity) + source = ((BannerBlockEntity) te).getPatterns(); + else + source = ((TileEntityColonyFlag) te).getPatterns(); + + CompoundTag bannerPattern = new CompoundTag(); + source.forEach((pattern) -> patternsBuilder.addPattern(pattern.getFirst(), pattern.getSecond())); + bannerPattern.put(TAG_BANNER_PATTERNS, patternsBuilder.toListTag()); + + stack.addTagElement("BlockEntityTag", bannerPattern); + return InteractionResult.SUCCESS; } return super.useOn(context); } From 708d3a750f0a8b0de45e474e412a52bf495d378e Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Mon, 2 Dec 2024 21:43:37 +0100 Subject: [PATCH 04/12] fix duplication of the first base --- .../core/tileentities/TileEntityColonyFlag.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java b/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java index bec4dcf9e34..c3c4c61dc91 100644 --- a/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java +++ b/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java @@ -98,10 +98,13 @@ public List, DyeColor>> getPatterns() } } - return BannerBlockEntity.createPatterns( - DyeColor.WHITE, + List, DyeColor>> pattern = BannerBlockEntity.createPatterns( + DyeColor.WHITE, // <-- add a useless white base layer this.patterns ); + //remove the first base layer + pattern.remove(0); + return pattern; } /** From d5580c796f27b77951e7e1b1adf86104371b4d69 Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Mon, 2 Dec 2024 21:48:38 +0100 Subject: [PATCH 05/12] fix missing base & add empty tooltip --- .../minecolonies/core/items/ItemColonyFlagBanner.java | 10 ++++++---- .../assets/minecolonies/lang/manual_en_us.json | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java index 81a852145e4..6ede8250ddb 100644 --- a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java +++ b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java @@ -10,6 +10,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.BannerItem; +import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; @@ -76,9 +77,10 @@ public InteractionResult useOn(UseOnContext context) @Override public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { - super.appendHoverText(stack, worldIn, tooltip, flagIn); - - // Remove the base, as they have no translations (Mojang were lazy. Or maybe saving space?) - if (tooltip.size() > 1) tooltip.remove(1); + CompoundTag tag = BlockItem.getBlockEntityData(stack); + if (tag != null && tag.contains(TAG_BANNER_PATTERNS)) + super.appendHoverText(stack, worldIn, tooltip, flagIn); + else + tooltip.add(Component.translatable("com.mincolonies.coremod.item.colony_baner.tooltipempty")); } } diff --git a/src/main/resources/assets/minecolonies/lang/manual_en_us.json b/src/main/resources/assets/minecolonies/lang/manual_en_us.json index 5f2e375f588..8165f768d39 100644 --- a/src/main/resources/assets/minecolonies/lang/manual_en_us.json +++ b/src/main/resources/assets/minecolonies/lang/manual_en_us.json @@ -1921,6 +1921,7 @@ "com.minecolonies.coremod.gui.flag.base_layer": "Base", "com.minecolonies.coremod.gui.townhall.edit_flag": "Edit Colony Flag", "block.minecolonies.colony_banner": "Colony Flag Banner", + "com.mincolonies.coremod.item.colony_baner.tooltipempty": "Right click to copy pattern on the item", "com.minecolonies.coremod.gui.locate": "Locate", "com.minecolonies.coremod.locating": "Successfully located rack with respective item(s).", From 8ee7cfbd8fc7c7b12c5ecd9f1326eb4b0bee991b Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Mon, 2 Dec 2024 21:54:34 +0100 Subject: [PATCH 06/12] remove unused import & fix indentation --- .../com/minecolonies/core/items/ItemColonyFlagBanner.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java index 6ede8250ddb..3a0f6ab61a0 100644 --- a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java +++ b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java @@ -4,10 +4,7 @@ import com.minecolonies.core.tileentities.TileEntityColonyFlag; import com.mojang.datafixers.util.Pair; -import net.minecraft.world.level.block.AbstractBannerBlock; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BannerPatterns; -import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.BannerItem; import net.minecraft.world.item.BlockItem; @@ -16,7 +13,6 @@ import net.minecraft.world.item.context.UseOnContext; import net.minecraft.core.Holder; import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; import net.minecraft.world.level.block.entity.BannerBlockEntity; import net.minecraft.world.level.block.entity.BannerPattern; import net.minecraft.world.level.block.entity.BlockEntity; @@ -60,9 +56,9 @@ public InteractionResult useOn(UseOnContext context) List, DyeColor>> source; if (te instanceof BannerBlockEntity) - source = ((BannerBlockEntity) te).getPatterns(); + source = ((BannerBlockEntity) te).getPatterns(); else - source = ((TileEntityColonyFlag) te).getPatterns(); + source = ((TileEntityColonyFlag) te).getPatterns(); CompoundTag bannerPattern = new CompoundTag(); source.forEach((pattern) -> patternsBuilder.addPattern(pattern.getFirst(), pattern.getSecond())); From d234d06a57e477340b0770888cd36cf32ae0c271 Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Mon, 2 Dec 2024 22:35:30 +0100 Subject: [PATCH 07/12] remove comment --- .../minecolonies/core/tileentities/TileEntityColonyFlag.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java b/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java index c3c4c61dc91..e3c92d49f67 100644 --- a/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java +++ b/src/main/java/com/minecolonies/core/tileentities/TileEntityColonyFlag.java @@ -99,7 +99,7 @@ public List, DyeColor>> getPatterns() } List, DyeColor>> pattern = BannerBlockEntity.createPatterns( - DyeColor.WHITE, // <-- add a useless white base layer + DyeColor.WHITE, this.patterns ); //remove the first base layer From cb16c4bb50479a1476c49c08a2ea35d72dbc1422 Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Mon, 2 Dec 2024 22:41:26 +0100 Subject: [PATCH 08/12] fix broken indentation --- .../core/items/ItemColonyFlagBanner.java | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java index 3a0f6ab61a0..20b3512d27c 100644 --- a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java +++ b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java @@ -50,22 +50,23 @@ public InteractionResult useOn(UseOnContext context) BlockEntity te = context.getLevel().getBlockEntity(context.getClickedPos()); ItemStack stack = context.getItemInHand(); - if (te instanceof BannerBlockEntity || te instanceof TileEntityColonyFlag) - { - BannerPattern.Builder patternsBuilder = new BannerPattern.Builder(); - List, DyeColor>> source; - - if (te instanceof BannerBlockEntity) - source = ((BannerBlockEntity) te).getPatterns(); - else - source = ((TileEntityColonyFlag) te).getPatterns(); - - CompoundTag bannerPattern = new CompoundTag(); - source.forEach((pattern) -> patternsBuilder.addPattern(pattern.getFirst(), pattern.getSecond())); - bannerPattern.put(TAG_BANNER_PATTERNS, patternsBuilder.toListTag()); - - stack.addTagElement("BlockEntityTag", bannerPattern); - return InteractionResult.SUCCESS; + if (te instanceof BannerBlockEntity || te instanceof TileEntityColonyFlag) { + BannerPattern.Builder patternsBuilder = new BannerPattern.Builder(); + List, DyeColor>> source; + + if (te instanceof BannerBlockEntity) { + source = ((BannerBlockEntity) te).getPatterns(); + } + else { + source = ((TileEntityColonyFlag) te).getPatterns(); + } + + CompoundTag bannerPattern = new CompoundTag(); + source.forEach((pattern) -> patternsBuilder.addPattern(pattern.getFirst(), pattern.getSecond())); + bannerPattern.put(TAG_BANNER_PATTERNS, patternsBuilder.toListTag()); + + stack.addTagElement("BlockEntityTag", bannerPattern); + return InteractionResult.SUCCESS; } return super.useOn(context); } From 85393c0b066e287d62e74a050dd561c6db7e614b Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Mon, 2 Dec 2024 22:44:30 +0100 Subject: [PATCH 09/12] fix last indentation error --- .../core/items/ItemColonyFlagBanner.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java index 20b3512d27c..61a5fd00c10 100644 --- a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java +++ b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java @@ -72,12 +72,12 @@ public InteractionResult useOn(UseOnContext context) } @Override - public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) - { - CompoundTag tag = BlockItem.getBlockEntityData(stack); - if (tag != null && tag.contains(TAG_BANNER_PATTERNS)) - super.appendHoverText(stack, worldIn, tooltip, flagIn); - else - tooltip.add(Component.translatable("com.mincolonies.coremod.item.colony_baner.tooltipempty")); + public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { + CompoundTag tag = BlockItem.getBlockEntityData(stack); + if (tag != null && tag.contains(TAG_BANNER_PATTERNS)) { + super.appendHoverText(stack, worldIn, tooltip, flagIn); + } else { + tooltip.add(Component.translatable("com.mincolonies.coremod.item.colony_baner.tooltipempty")); + } } } From d5bcacea274cadb241ba685051540e1b110b299c Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Mon, 2 Dec 2024 22:56:33 +0100 Subject: [PATCH 10/12] fix translation --- .../java/com/minecolonies/core/items/ItemColonyFlagBanner.java | 2 +- src/main/resources/assets/minecolonies/lang/manual_en_us.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java index 61a5fd00c10..81a72fd38f3 100644 --- a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java +++ b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java @@ -77,7 +77,7 @@ public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List Date: Tue, 3 Dec 2024 20:28:07 +0100 Subject: [PATCH 11/12] fix style --- .../core/items/ItemColonyFlagBanner.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java index 81a72fd38f3..659e1a1e736 100644 --- a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java +++ b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java @@ -50,14 +50,17 @@ public InteractionResult useOn(UseOnContext context) BlockEntity te = context.getLevel().getBlockEntity(context.getClickedPos()); ItemStack stack = context.getItemInHand(); - if (te instanceof BannerBlockEntity || te instanceof TileEntityColonyFlag) { + if (te instanceof BannerBlockEntity || te instanceof TileEntityColonyFlag) + { BannerPattern.Builder patternsBuilder = new BannerPattern.Builder(); List, DyeColor>> source; - if (te instanceof BannerBlockEntity) { + if (te instanceof BannerBlockEntity) + { source = ((BannerBlockEntity) te).getPatterns(); } - else { + else + { source = ((TileEntityColonyFlag) te).getPatterns(); } @@ -74,9 +77,12 @@ public InteractionResult useOn(UseOnContext context) @Override public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { CompoundTag tag = BlockItem.getBlockEntityData(stack); - if (tag != null && tag.contains(TAG_BANNER_PATTERNS)) { + if (tag != null && tag.contains(TAG_BANNER_PATTERNS)) + { super.appendHoverText(stack, worldIn, tooltip, flagIn); - } else { + } + else + { tooltip.add(Component.translatable("com.minecolonies.coremod.item.colony_banner.tooltipempty")); } } From 3e131cd2c9caf47b7e05404e518b71afa76dac86 Mon Sep 17 00:00:00 2001 From: cylian charbonnier Date: Thu, 5 Dec 2024 00:23:46 +0100 Subject: [PATCH 12/12] fix formatting, again --- .../java/com/minecolonies/core/items/ItemColonyFlagBanner.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java index 659e1a1e736..4f5aa15ba6c 100644 --- a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java +++ b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java @@ -75,7 +75,8 @@ public InteractionResult useOn(UseOnContext context) } @Override - public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { + public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) + { CompoundTag tag = BlockItem.getBlockEntityData(stack); if (tag != null && tag.contains(TAG_BANNER_PATTERNS)) {