forked from LogBlock/LogBlock
improve sign change log display
This commit is contained in:
@ -143,11 +143,8 @@ public class BlockStateCodecSign implements BlockStateCodec {
|
|||||||
tc.addExtra(isWaxed ? "(waxed)" : "(not waxed)");
|
tc.addExtra(isWaxed ? "(waxed)" : "(not waxed)");
|
||||||
}
|
}
|
||||||
for (Side side : Side.values()) {
|
for (Side side : Side.values()) {
|
||||||
|
boolean sideHeaderAdded = false;
|
||||||
ConfigurationSection sideSection = side == Side.FRONT ? state : state.getConfigurationSection(side.name().toLowerCase());
|
ConfigurationSection sideSection = side == Side.FRONT ? state : state.getConfigurationSection(side.name().toLowerCase());
|
||||||
if (tc.getExtra() != null && !tc.getExtra().isEmpty()) {
|
|
||||||
tc.addExtra(" ");
|
|
||||||
}
|
|
||||||
tc.addExtra(side.name() + ":");
|
|
||||||
|
|
||||||
List<String> lines = sideSection == null ? Collections.emptyList() : sideSection.getStringList("lines");
|
List<String> lines = sideSection == null ? Collections.emptyList() : sideSection.getStringList("lines");
|
||||||
List<String> oldLines = Collections.emptyList();
|
List<String> oldLines = Collections.emptyList();
|
||||||
@ -178,6 +175,7 @@ public class BlockStateCodecSign implements BlockStateCodec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!lines.equals(oldLines)) {
|
if (!lines.equals(oldLines)) {
|
||||||
|
sideHeaderAdded = addSideHeaderText(tc, side, sideHeaderAdded);
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
if (tc.getExtra() != null && !tc.getExtra().isEmpty()) {
|
if (tc.getExtra() != null && !tc.getExtra().isEmpty()) {
|
||||||
tc.addExtra(" ");
|
tc.addExtra(" ");
|
||||||
@ -190,6 +188,7 @@ public class BlockStateCodecSign implements BlockStateCodec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (signColor != oldSignColor) {
|
if (signColor != oldSignColor) {
|
||||||
|
sideHeaderAdded = addSideHeaderText(tc, side, sideHeaderAdded);
|
||||||
if (tc.getExtra() != null && !tc.getExtra().isEmpty()) {
|
if (tc.getExtra() != null && !tc.getExtra().isEmpty()) {
|
||||||
tc.addExtra(" ");
|
tc.addExtra(" ");
|
||||||
}
|
}
|
||||||
@ -200,6 +199,7 @@ public class BlockStateCodecSign implements BlockStateCodec {
|
|||||||
tc.addExtra(")");
|
tc.addExtra(")");
|
||||||
}
|
}
|
||||||
if (glowing != oldGlowing) {
|
if (glowing != oldGlowing) {
|
||||||
|
sideHeaderAdded = addSideHeaderText(tc, side, sideHeaderAdded);
|
||||||
if (tc.getExtra() != null && !tc.getExtra().isEmpty()) {
|
if (tc.getExtra() != null && !tc.getExtra().isEmpty()) {
|
||||||
tc.addExtra(" ");
|
tc.addExtra(" ");
|
||||||
}
|
}
|
||||||
@ -214,4 +214,14 @@ public class BlockStateCodecSign implements BlockStateCodec {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean addSideHeaderText(TextComponent tc, Side side, boolean wasAdded) {
|
||||||
|
if (!wasAdded) {
|
||||||
|
if (tc.getExtra() != null && !tc.getExtra().isEmpty()) {
|
||||||
|
tc.addExtra(" ");
|
||||||
|
}
|
||||||
|
tc.addExtra(side.name() + ":");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user