From 90da3378bb88b2f177d2a69e41365bc910e24d49 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:20:58 +0200 Subject: [PATCH] Update sign processor --- .../create/foundation/utility/NBTProcessors.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/utility/NBTProcessors.java b/src/main/java/com/simibubi/create/foundation/utility/NBTProcessors.java index 7991fedaf..4496e5a27 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/NBTProcessors.java +++ b/src/main/java/com/simibubi/create/foundation/utility/NBTProcessors.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.utility; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.function.UnaryOperator; @@ -11,6 +12,7 @@ import com.simibubi.create.AllBlockEntityTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.tags.BlockTags; @@ -61,9 +63,15 @@ public final class NBTProcessors { // Triggered by block tag, not BE type private static final UnaryOperator signProcessor = data -> { - for (int i = 0; i < 4; ++i) - if (textComponentHasClickEvent(data.getString("Text" + (i + 1)))) - return null; + for (String key : List.of("front_text", "back_text")) { + CompoundTag textTag = data.getCompound(key); + if (!textTag.contains("messages", Tag.TAG_LIST)) + continue; + for (Tag tag : textTag.getList("messages", Tag.TAG_STRING)) + if (tag instanceof StringTag stringTag) + if (textComponentHasClickEvent(stringTag.getAsString())) + return null; + } return data; };