Skip to content

Commit

Permalink
Skip modification of entry if the contents are empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkhax committed Nov 2, 2023
1 parent 9023b44 commit 4cb2126
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.darkhax.bookshelf.api.util.TextHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentContents;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -78,7 +79,14 @@ private static UnaryOperator<SignText> applySignFont(ResourceLocation fontId) {

for (int i = 0; i < 4; i++) {

newText = newText.setMessage(i, TextHelper.applyFont(text.getMessage(i, false).copy(), fontId));
final Component lineText = text.getMessage(i, false);

if (lineText.getContents() == ComponentContents.EMPTY) {

continue;
}

newText = newText.setMessage(i, TextHelper.applyFont(lineText.copy(), fontId));
}

return newText;
Expand Down

0 comments on commit 4cb2126

Please sign in to comment.