mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 00:16:27 +01:00
Fix some more text components
This commit is contained in:
parent
33b8d2bd85
commit
0d972e144f
19 changed files with 75 additions and 81 deletions
|
@ -70,9 +70,13 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
|
|||
float stressTotal = stressBase * speed;
|
||||
|
||||
// FIXME add colours back
|
||||
String stressString = spacing + "%s" + Lang.translate("generic.unit.stress").getUnformattedComponentText() + " %s";
|
||||
tooltip.add(ITextComponent.of(String.format(stressString, IHaveGoggleInformation.format(stressBase), Lang.translate("gui.goggles.base_value").getUnformattedComponentText())));
|
||||
tooltip.add(ITextComponent.of(String.format(stressString, IHaveGoggleInformation.format(stressTotal), Lang.translate("gui.goggles.at_current_speed").getUnformattedComponentText())));
|
||||
// String stressString = spacing + "%s" + Lang.translate("generic.unit.stress").getUnformattedComponentText() + " %s";
|
||||
// tooltip.add(ITextComponent.of(String.format(stressString, IHaveGoggleInformation.format(stressBase), Lang.translate("gui.goggles.base_value").getUnformattedComponentText())));
|
||||
// tooltip.add(ITextComponent.of(String.format(stressString, IHaveGoggleInformation.format(stressTotal), Lang.translate("gui.goggles.at_current_speed").getUnformattedComponentText())));
|
||||
tooltip.add(componentSpacing.copy().append(new StringTextComponent(IHaveGoggleInformation.format(stressBase))
|
||||
.append(Lang.translate("generic.unit.stress")).append(" ").formatted(TextFormatting.AQUA)).append(Lang.translate("gui.goggles.base_value").formatted(TextFormatting.DARK_GRAY)));
|
||||
tooltip.add(componentSpacing.copy().append(new StringTextComponent(IHaveGoggleInformation.format(stressTotal))
|
||||
.append(Lang.translate("generic.unit.stress")).append(" ").formatted(TextFormatting.GRAY)).append(Lang.translate("gui.goggles.at_current_speed").formatted(TextFormatting.DARK_GRAY)));
|
||||
|
||||
added = true;
|
||||
}
|
||||
|
|
|
@ -380,19 +380,19 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.stressometer.overstressed").formatted(GOLD)));
|
||||
ITextComponent hint = Lang.translate("gui.contraptions.network_overstressed", I18n.format(getBlockState().getBlock()
|
||||
.getTranslationKey()));
|
||||
List<String> cutString = TooltipHelper.cutString(new StringTextComponent(spacing).append(hint), GRAY, TextFormatting.WHITE);
|
||||
List<String> cutString = TooltipHelper.cutString(componentSpacing.copy().append(hint), GRAY, TextFormatting.WHITE);
|
||||
for (int i = 0; i < cutString.size(); i++)
|
||||
tooltip.add(ITextComponent.of((i == 0 ? "" : spacing) + cutString.get(i)));
|
||||
tooltip.add((i == 0 ? StringTextComponent.EMPTY : componentSpacing).copy().append(cutString.get(i)));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (notFastEnough) {
|
||||
tooltip.add(ITextComponent.of(spacing + GOLD + Lang.translate("tooltip.speedRequirement")));
|
||||
tooltip.add(componentSpacing.copy().append(Lang.translate("tooltip.speedRequirement").formatted(GOLD)));
|
||||
ITextComponent hint = Lang.translate("gui.contraptions.not_fast_enough", I18n.format(getBlockState().getBlock()
|
||||
.getTranslationKey()));
|
||||
List<String> cutString = TooltipHelper.cutString(new StringTextComponent(spacing).append(hint), GRAY, TextFormatting.WHITE);
|
||||
List<String> cutString = TooltipHelper.cutString(componentSpacing.copy().append(hint), GRAY, TextFormatting.WHITE);
|
||||
for (int i = 0; i < cutString.size(); i++)
|
||||
tooltip.add(ITextComponent.of((i == 0 ? "" : spacing) + cutString.get(i)));
|
||||
tooltip.add((i == 0 ? StringTextComponent.EMPTY : componentSpacing).copy().append(cutString.get(i)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -410,13 +410,12 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
|
||||
float stressTotal = stressAtBase * Math.abs(getSpeed());
|
||||
|
||||
String stressString =
|
||||
spacing + "%s%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s";
|
||||
tooltip.add(componentSpacing.copy().append(new StringTextComponent(IHaveGoggleInformation.format(stressAtBase))
|
||||
.append(Lang.translate("generic.unit.stress")).append(" ").formatted(TextFormatting.AQUA)).append(Lang.translate("gui.goggles.base_value").formatted(TextFormatting.DARK_GRAY)));
|
||||
tooltip.add(componentSpacing.copy().append(new StringTextComponent(IHaveGoggleInformation.format(stressTotal))
|
||||
.append(Lang.translate("generic.unit.stress")).append(" ").formatted(TextFormatting.GRAY)).append(Lang.translate("gui.goggles.at_current_speed").formatted(TextFormatting.DARK_GRAY)));
|
||||
|
||||
|
||||
tooltip.add(ITextComponent.of(String.format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressAtBase),
|
||||
Lang.translate("gui.goggles.base_value"))));
|
||||
tooltip.add(ITextComponent.of(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal),
|
||||
Lang.translate("gui.goggles.at_current_speed"))));
|
||||
|
||||
added = true;
|
||||
}
|
||||
|
|
|
@ -23,19 +23,19 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
|
|||
private final List<ITextComponent> tooltip;
|
||||
|
||||
public GoggleConfigScreen() {
|
||||
ITextComponent spacing = ITextComponent.of(" ");
|
||||
ITextComponent componentSpacing = ITextComponent.of(" ");
|
||||
tooltip = new ArrayList<>();
|
||||
tooltip.add(spacing.copy().append(Lang.translate("gui.config.overlay1")));
|
||||
tooltip.add(spacing.copy().append(Lang.translate("gui.config.overlay2").formatted(TextFormatting.GRAY)));
|
||||
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.config.overlay1")));
|
||||
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.config.overlay2").formatted(TextFormatting.GRAY)));
|
||||
tooltip.add(StringTextComponent.EMPTY);
|
||||
tooltip.add(spacing.copy().append(Lang.translate("gui.config.overlay3")));
|
||||
tooltip.add(spacing.copy().append(Lang.translate("gui.config.overlay4")));
|
||||
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.config.overlay3")));
|
||||
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.config.overlay4")));
|
||||
tooltip.add(StringTextComponent.EMPTY);
|
||||
tooltip.add(spacing.copy().append(Lang.translate("gui.config.overlay5").formatted(TextFormatting.GRAY)));
|
||||
tooltip.add(spacing.copy().append(Lang.translate("gui.config.overlay6").formatted(TextFormatting.GRAY)));
|
||||
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.config.overlay5").formatted(TextFormatting.GRAY)));
|
||||
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.config.overlay6").formatted(TextFormatting.GRAY)));
|
||||
tooltip.add(StringTextComponent.EMPTY);
|
||||
tooltip.add(spacing.copy().append(Lang.translate("gui.config.overlay7")));
|
||||
tooltip.add(spacing.copy().append(Lang.translate("gui.config.overlay8")));
|
||||
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.config.overlay7")));
|
||||
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.config.overlay8")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,8 +70,9 @@ public class StressGaugeTileEntity extends GaugeTileEntity {
|
|||
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.stressometer.title").formatted(TextFormatting.GRAY)));
|
||||
|
||||
if (getTheoreticalSpeed() == 0)
|
||||
tooltip.add(ITextComponent.of(TextFormatting.DARK_GRAY + ItemDescription.makeProgressBar(3, -1)
|
||||
+ Lang.translate("gui.stressometer.no_rotation")));
|
||||
tooltip.add(new StringTextComponent(ItemDescription.makeProgressBar(3, -1)).append(Lang.translate("gui.stressometer.no_rotation")).formatted(TextFormatting.DARK_GRAY));
|
||||
// tooltip.add(ITextComponent.of(TextFormatting.DARK_GRAY + ItemDescription.makeProgressBar(3, -1)
|
||||
// + Lang.translate("gui.stressometer.no_rotation")));
|
||||
else {
|
||||
tooltip.add(componentSpacing.copy().append(StressImpact.getFormattedStressText(stressFraction)));
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.util.Hand;
|
|||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.fml.network.PacketDistributor;
|
||||
|
||||
public class SymmetryWandScreen extends AbstractSimiScreen {
|
||||
|
@ -59,9 +60,9 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
|
|||
AllGuiTextures background = AllGuiTextures.WAND_OF_SYMMETRY;
|
||||
this.setWindowSize(background.width + 50, background.height + 50);
|
||||
|
||||
labelType = new Label(guiLeft + 49, guiTop + 26, "").colored(0xFFFFFFFF)
|
||||
labelType = new Label(guiLeft + 49, guiTop + 26, StringTextComponent.EMPTY).colored(0xFFFFFFFF)
|
||||
.withShadow();
|
||||
labelAlign = new Label(guiLeft + 49, guiTop + 48, "").colored(0xFFFFFFFF)
|
||||
labelAlign = new Label(guiLeft + 49, guiTop + 48, StringTextComponent.EMPTY).colored(0xFFFFFFFF)
|
||||
.withShadow();
|
||||
|
||||
int state =
|
||||
|
|
|
@ -63,7 +63,7 @@ public class BlockzapperScreen extends ZapperScreen {
|
|||
spreadMaterialIndicator.state = State.ON;
|
||||
spreadMaterialButton.setToolTip(Lang.translate("gui.blockzapper.searchFuzzy"));
|
||||
|
||||
spreadRangeLabel = new Label(i + 79, j + 78, "").withShadow().withSuffix("m");
|
||||
spreadRangeLabel = new Label(i + 79, j + 78, StringTextComponent.EMPTY).withShadow().withSuffix("m");
|
||||
spreadRangeInput = new ScrollInput(i + 73, j + 73, 26, 18).withRange(1, BlockzapperItem.getMaxAoe(zapper))
|
||||
.setState(1).titled(Lang.translate("gui.blockzapper.range")).writingTo(spreadRangeLabel);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.nbt.CompoundNBT;
|
|||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
public class WorldshaperScreen extends ZapperScreen {
|
||||
|
||||
|
@ -52,7 +53,7 @@ public class WorldshaperScreen extends ZapperScreen {
|
|||
i = guiLeft - 20;
|
||||
j = guiTop;
|
||||
|
||||
brushLabel = new Label(i + 61, j + 23, "").withShadow();
|
||||
brushLabel = new Label(i + 61, j + 23, StringTextComponent.EMPTY).withShadow();
|
||||
brushInput = new SelectionScrollInput(i + 56, j + 18, 77, 18).forOptions(brushOptions)
|
||||
.titled(Lang.translate("gui.terrainzapper.brush"))
|
||||
.writingTo(brushLabel)
|
||||
|
@ -115,7 +116,7 @@ public class WorldshaperScreen extends ZapperScreen {
|
|||
Brush currentBrush = TerrainBrushes.values()[brushInput.getState()].get();
|
||||
for (int index = 0; index < 3; index++) {
|
||||
|
||||
Label label = new Label(i + 65 + 20 * index, j + 43, "").withShadow();
|
||||
Label label = new Label(i + 65 + 20 * index, j + 43, StringTextComponent.EMPTY).withShadow();
|
||||
brushParamLabels.add(label);
|
||||
int indexFinal = index;
|
||||
ScrollInput input = new ScrollInput(i + 56 + 20 * index, j + 38, 18, 18)
|
||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraft.client.renderer.Rectangle2d;
|
|||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
public class AdjustableCrateScreen extends AbstractSimiContainerScreen<AdjustableCrateContainer> {
|
||||
|
||||
|
@ -48,7 +49,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
|
|||
super.init();
|
||||
widgets.clear();
|
||||
|
||||
allowedItemsLabel = new Label(guiLeft + 100 + 69, guiTop + 108, "").colored(0xfefefe)
|
||||
allowedItemsLabel = new Label(guiLeft + 100 + 69, guiTop + 108, StringTextComponent.EMPTY).colored(0xfefefe)
|
||||
.withShadow();
|
||||
allowedItems = new ScrollInput(guiLeft + 100 + 65, guiTop + 104, 41, 14).titled(storageSpace.copy())
|
||||
.withRange(1, (container.doubleCrate ? 2049 : 1025))
|
||||
|
|
|
@ -86,7 +86,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
|
|||
|
||||
handleIndicators();
|
||||
|
||||
attributeSelectorLabel = new Label(x + 43, y + 26, "").colored(0xF3EBDE).withShadow();
|
||||
attributeSelectorLabel = new Label(x + 43, y + 26, StringTextComponent.EMPTY).colored(0xF3EBDE).withShadow();
|
||||
attributeSelector = new SelectionScrollInput(x + 39, y + 21, 137, 18);
|
||||
attributeSelector.forOptions(Arrays.asList(StringTextComponent.EMPTY));
|
||||
attributeSelector.removeCallback();
|
||||
|
|
|
@ -68,7 +68,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
CreateClient.schematicSender.refresh();
|
||||
List<ITextComponent> availableSchematics = CreateClient.schematicSender.getAvailableSchematics();
|
||||
|
||||
schematicsLabel = new Label(mainLeft + 49, mainTop + 26, "").withShadow();
|
||||
schematicsLabel = new Label(mainLeft + 49, mainTop + 26, StringTextComponent.EMPTY).withShadow();
|
||||
schematicsLabel.text = StringTextComponent.EMPTY;
|
||||
if (!availableSchematics.isEmpty()) {
|
||||
schematicsArea =
|
||||
|
|
|
@ -133,22 +133,6 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
// Replace settings
|
||||
replaceLevelButtons = new Vector<>(4);
|
||||
replaceLevelIndicators = new Vector<>(4);
|
||||
/*
|
||||
<<<<<<< HEAD
|
||||
List<AllIcons> icons = ImmutableList
|
||||
.of(AllIcons.I_DONT_REPLACE, AllIcons.I_REPLACE_SOLID, AllIcons.I_REPLACE_ANY,
|
||||
AllIcons.I_REPLACE_EMPTY);
|
||||
List<ITextComponent> toolTips = ImmutableList
|
||||
.of(Lang.translate("gui.schematicannon.option.dontReplaceSolid"),
|
||||
Lang.translate("gui.schematicannon.option.replaceWithSolid"),
|
||||
Lang.translate("gui.schematicannon.option.replaceWithAny"),
|
||||
Lang.translate("gui.schematicannon.option.replaceWithEmpty"));
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
replaceLevelIndicators.add(new Indicator(x + 16 + i * 18, y + 96, StringTextComponent.EMPTY));
|
||||
replaceLevelButtons.add(new IconButton(x + 16 + i * 18, y + 101, icons.get(i)));
|
||||
replaceLevelButtons.get(i).setToolTip(toolTips.get(i));
|
||||
=======*/
|
||||
List<AllIcons> icons = ImmutableList.of(AllIcons.I_DONT_REPLACE, AllIcons.I_REPLACE_SOLID,
|
||||
AllIcons.I_REPLACE_ANY, AllIcons.I_REPLACE_EMPTY);
|
||||
List<ITextComponent> toolTips = ImmutableList.of(Lang.translate("gui.schematicannon.option.dontReplaceSolid"),
|
||||
|
|
|
@ -89,14 +89,14 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
|
||||
PlacementSettings settings = handler.getTransformation()
|
||||
.toSettings();
|
||||
Label labelR = new Label(x + 50, y + 48, "").withShadow();
|
||||
Label labelR = new Label(x + 50, y + 48, StringTextComponent.EMPTY).withShadow();
|
||||
rotationArea = new SelectionScrollInput(x + 45, y + 43, 118, 18).forOptions(rotationOptions)
|
||||
.titled(rotationLabel.copy())
|
||||
.setState(settings.getRotation()
|
||||
.ordinal())
|
||||
.writingTo(labelR);
|
||||
|
||||
Label labelM = new Label(x + 50, y + 70, "").withShadow();
|
||||
Label labelM = new Label(x + 50, y + 70, StringTextComponent.EMPTY).withShadow();
|
||||
mirrorArea = new SelectionScrollInput(x + 45, y + 65, 118, 18).forOptions(mirrorOptions)
|
||||
.titled(mirrorLabel.copy())
|
||||
.setState(settings.getMirror()
|
||||
|
|
|
@ -16,8 +16,8 @@ public class Label extends AbstractSimiWidget {
|
|||
protected int color;
|
||||
protected FontRenderer font;
|
||||
|
||||
public Label(int x, int y, String text) {
|
||||
super(x, y, Minecraft.getInstance().fontRenderer.getStringWidth(text), 10);
|
||||
public Label(int x, int y, ITextComponent text) {
|
||||
super(x, y, Minecraft.getInstance().fontRenderer.getWidth(text), 10);
|
||||
font = Minecraft.getInstance().fontRenderer;
|
||||
this.text = ITextComponent.of("Label");
|
||||
color = 0xFFFFFF;
|
||||
|
@ -76,9 +76,9 @@ public class Label extends AbstractSimiWidget {
|
|||
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
if (hasShadow)
|
||||
font.drawWithShadow(matrixStack, text + suffix, x, y, color);
|
||||
font.drawWithShadow(matrixStack, text.copy().append(suffix), x, y, color);
|
||||
else
|
||||
font.draw(matrixStack, text + suffix, x, y, color);
|
||||
font.draw(matrixStack, text.copy().append(suffix), x, y, color);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ public class ScrollInput extends AbstractSimiWidget {
|
|||
|
||||
protected Consumer<Integer> onScroll;
|
||||
protected int state;
|
||||
protected IFormattableTextComponent title = Lang.translate("gui.scrollInput.defaultTitle");
|
||||
protected final IFormattableTextComponent scrollToModify = Lang.translate("gui.scrollInput.scrollToModify");
|
||||
protected final IFormattableTextComponent shiftScrollsFaster = Lang.translate("gui.scrollInput.shiftScrollsFaster");
|
||||
protected ITextComponent title = Lang.translate("gui.scrollInput.defaultTitle");
|
||||
protected final ITextComponent scrollToModify = Lang.translate("gui.scrollInput.scrollToModify");
|
||||
protected final ITextComponent shiftScrollsFaster = Lang.translate("gui.scrollInput.shiftScrollsFaster");
|
||||
protected Label displayLabel;
|
||||
|
||||
protected int min, max;
|
||||
|
@ -136,9 +136,9 @@ public class ScrollInput extends AbstractSimiWidget {
|
|||
|
||||
protected void updateTooltip() {
|
||||
toolTip.clear();
|
||||
toolTip.add(title.formatted(TextFormatting.BLUE));
|
||||
toolTip.add(scrollToModify.formatted(TextFormatting.ITALIC, TextFormatting.DARK_GRAY));
|
||||
toolTip.add(shiftScrollsFaster.formatted(TextFormatting.ITALIC, TextFormatting.DARK_GRAY));
|
||||
toolTip.add(title.copy().formatted(TextFormatting.BLUE));
|
||||
toolTip.add(scrollToModify.copy().formatted(TextFormatting.ITALIC, TextFormatting.DARK_GRAY));
|
||||
toolTip.add(shiftScrollsFaster.copy().formatted(TextFormatting.ITALIC, TextFormatting.DARK_GRAY));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class SelectionScrollInput extends ScrollInput {
|
|||
@Override
|
||||
protected void updateTooltip() {
|
||||
toolTip.clear();
|
||||
toolTip.add(title.formatted(TextFormatting.BLUE));
|
||||
toolTip.add(title.copy().formatted(TextFormatting.BLUE));
|
||||
for (int i = min; i < max; i++) {
|
||||
if (i == state)
|
||||
toolTip.add(StringTextComponent.EMPTY.copy().append("-> ").append(options.get(i)).formatted(TextFormatting.WHITE));
|
||||
|
|
|
@ -162,9 +162,9 @@ public class ValueBox extends ChasingAABBOutline {
|
|||
}
|
||||
|
||||
public static class TextValueBox extends ValueBox {
|
||||
String text;
|
||||
ITextComponent text;
|
||||
|
||||
public TextValueBox(ITextComponent label, AxisAlignedBB bb, BlockPos pos, String text) {
|
||||
public TextValueBox(ITextComponent label, AxisAlignedBB bb, BlockPos pos, ITextComponent text) {
|
||||
super(label, bb, pos);
|
||||
this.text = text;
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public class ValueBox extends ChasingAABBOutline {
|
|||
ms.scale(scale, scale, 1);
|
||||
ms.translate(-4, -4, 5);
|
||||
|
||||
int stringWidth = font.getStringWidth(text);
|
||||
int stringWidth = font.getWidth(text);
|
||||
float numberScale = (float) font.FONT_HEIGHT / stringWidth;
|
||||
boolean singleDigit = stringWidth < 10;
|
||||
if (singleDigit)
|
||||
|
@ -187,7 +187,7 @@ public class ValueBox extends ChasingAABBOutline {
|
|||
ms.scale(numberScale, numberScale, numberScale);
|
||||
ms.translate(singleDigit ? stringWidth / 2 : 0, singleDigit ? -verticalMargin : verticalMargin, 0);
|
||||
|
||||
renderHoveringText(ms, buffer, ITextComponent.of(text), 0xEDEDED, 0x4f4f4f);
|
||||
renderHoveringText(ms, buffer, text, 0xEDEDED, 0x4f4f4f);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class FilteringRenderer {
|
|||
|
||||
box.offsetLabel(behaviour.textShift)
|
||||
.withColors(0x7A6A2C, 0xB79D64)
|
||||
.scrollTooltip(ITextComponent.of(showCount ? "[" + Lang.translate("action.scroll").getUnformattedComponentText() + "]" : ""))
|
||||
.scrollTooltip(showCount ? new StringTextComponent("[").append(Lang.translate("action.scroll")).append("]") : StringTextComponent.EMPTY)
|
||||
.passive(!hit);
|
||||
|
||||
CreateClient.outliner.showValueBox(Pair.of("filter", pos), box.transform(behaviour.slotPositioning))
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.util.math.BlockRayTraceResult;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
public class ScrollValueRenderer {
|
||||
|
||||
|
@ -62,12 +63,12 @@ public class ScrollValueRenderer {
|
|||
if (behaviour instanceof ScrollOptionBehaviour) {
|
||||
box = new IconValueBox(label, ((ScrollOptionBehaviour<?>) behaviour).getIconForSelected(), bb, pos);
|
||||
} else {
|
||||
box = new TextValueBox(label, bb, pos, behaviour.formatValue());
|
||||
box = new TextValueBox(label, bb, pos, new StringTextComponent(behaviour.formatValue()));
|
||||
if (behaviour.unit != null)
|
||||
box.subLabel(ITextComponent.of("(" + behaviour.unit.apply(behaviour.scrollableValue) + ")"));
|
||||
box.subLabel(new StringTextComponent("(").append(behaviour.unit.apply(behaviour.scrollableValue)).append(")"));
|
||||
}
|
||||
|
||||
box.scrollTooltip(ITextComponent.of("[" + Lang.translate("action.scroll").getUnformattedComponentText() + "]"));
|
||||
box.scrollTooltip(new StringTextComponent("[").append(Lang.translate("action.scroll")).append("]"));
|
||||
box.offsetLabel(behaviour.textShift.add(20, -10, 0))
|
||||
.withColors(0x5A5D5A, 0xB5B7B6)
|
||||
.passive(!highlight);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.simibubi.create.foundation.utility;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -12,22 +14,22 @@ import net.minecraftforge.fml.common.thread.EffectiveSide;
|
|||
public class Debug {
|
||||
|
||||
@Deprecated
|
||||
public static void debugChat(String message) {
|
||||
public static void debugChat(ITextComponent message) {
|
||||
if (Minecraft.getInstance().player != null)
|
||||
Minecraft.getInstance().player.sendStatusMessage(new StringTextComponent(message), false);
|
||||
Minecraft.getInstance().player.sendStatusMessage(message, false);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void debugChatAndShowStack(String message, int depth) {
|
||||
public static void debugChatAndShowStack(ITextComponent message, int depth) {
|
||||
if (Minecraft.getInstance().player != null)
|
||||
Minecraft.getInstance().player
|
||||
.sendStatusMessage(new StringTextComponent(message + " @" + debugStack(depth)), false);
|
||||
.sendStatusMessage(message.copy().append("@").append(debugStack(depth)), false);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void debugMessage(String message) {
|
||||
public static void debugMessage(ITextComponent message) {
|
||||
if (Minecraft.getInstance().player != null)
|
||||
Minecraft.getInstance().player.sendStatusMessage(new StringTextComponent(message), true);
|
||||
Minecraft.getInstance().player.sendStatusMessage(message, true);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -36,19 +38,19 @@ public class Debug {
|
|||
}
|
||||
|
||||
@Deprecated
|
||||
public static String debugStack(int depth) {
|
||||
public static ITextComponent debugStack(int depth) {
|
||||
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
|
||||
String text = "[" + TextFormatting.GOLD + getLogicalSide() + TextFormatting.WHITE + "] ";
|
||||
IFormattableTextComponent text = new StringTextComponent("[").append(new StringTextComponent(getLogicalSide()).formatted(TextFormatting.GOLD)).append("] ");
|
||||
for (int i = 1; i < depth + 2 && i < stackTraceElements.length; i++) {
|
||||
StackTraceElement e = stackTraceElements[i];
|
||||
if (e.getClassName().equals(Debug.class.getName()))
|
||||
continue;
|
||||
text = text + TextFormatting.YELLOW + e.getMethodName() + TextFormatting.WHITE + ", ";
|
||||
text.append(new StringTextComponent(e.getMethodName()).formatted(TextFormatting.YELLOW)).append(", ");
|
||||
}
|
||||
return text + TextFormatting.GRAY + " ...";
|
||||
return text.append(new StringTextComponent(" ...").formatted(TextFormatting.GRAY));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void markTemporary() {};
|
||||
public static void markTemporary() {}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue