Skip to content

Commit

Permalink
Change how sign text is modified to avoid polluting global text const…
Browse files Browse the repository at this point in the history
…ants.
  • Loading branch information
Darkhax committed Nov 2, 2023
1 parent bca409f commit 9023b44
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.darkhax.darkutilities.features.tomes;

import net.darkhax.bookshelf.api.util.TextHelper;
import net.darkhax.bookshelf.mixin.accessors.block.entity.AccessorSignBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -74,10 +73,15 @@ else if (blockEntity instanceof SignBlockEntity sign) {

private static UnaryOperator<SignText> applySignFont(ResourceLocation fontId) {
return text -> {

SignText newText = text;

for (int i = 0; i < 4; i++) {
text.setMessage(i, TextHelper.applyFont(text.getMessage(i, false), fontId));

newText = newText.setMessage(i, TextHelper.applyFont(text.getMessage(i, false).copy(), fontId));
}
return text;

return newText;
};
}

Expand Down

0 comments on commit 9023b44

Please sign in to comment.