Fix the material page rendering the registry name of fluids and fix the text of the modifier being the wrong color.
@@ -3,6 +3,7 @@ package slimeknights.tconstruct.library.book.content;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.gson.annotations.SerializedName;
+import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
@@ -45,6 +46,7 @@ import slimeknights.tconstruct.tools.stats.HeadMaterialStats;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -167,12 +169,19 @@ public class ContentMaterial extends TinkerPage {
List<ITextComponent> textComponents = mod.getDescriptionList();
List<IFormattableTextComponent> formatted = new ArrayList<>();
- for (ITextComponent textComponent : textComponents) {
+
+ for (int index = 0; index < textComponents.size(); index++) {
+ ITextComponent textComponent = textComponents.get(index);
+
+ if (index == 0) {
formatted.add(((IFormattableTextComponent) textComponent).modifyStyle(style -> style.setColor(material.getColor())));
+ } else {
+ formatted.add(((IFormattableTextComponent) textComponent));
+ }
}
textComponentData.tooltips = formatted.toArray(new ITextComponent[0]);
- textComponentData.text = textComponentData.text.deepCopy().mergeStyle(TextFormatting.GRAY).mergeStyle(TextFormatting.UNDERLINE);
+ textComponentData.text = textComponentData.text.deepCopy().mergeStyle(TextFormatting.DARK_GRAY).mergeStyle(TextFormatting.UNDERLINE);
lineData.add(textComponentData);
lineData.add(new TextComponentData("\n"));
@@ -199,8 +208,9 @@ public class ContentMaterial extends TinkerPage {
ItemStackList stacks = ItemStackList.of(castingBasin, castingTable);
ItemElement elementItem = new TinkerItemElement(0, 0, 1, stacks);
- String text = parent.translate("material.craft_casting");
- elementItem.tooltip = ImmutableList.of(new StringTextComponent(String.format(text, new TranslationTextComponent(material.get().getFluid().getRegistryName().toString()).getString())));
+ String text = this.parent.translate("material.craft_casting");
+ Fluid fluid = material.get().getFluid();
+ elementItem.tooltip = ImmutableList.of(new StringTextComponent(text).append(new TranslationTextComponent("fluid." + Objects.requireNonNull(fluid.getRegistryName()).getNamespace() + "." + Objects.requireNonNull(fluid.getRegistryName()).getPath())));
displayTools.add(elementItem);
}
