Language barrier

- Added LangBuilder to streamline things that make use of chat components
- Started migrating a bunch of text to use lang builders
- Glowing display board text now has a higher alpha
This commit is contained in:
simibubi 2022-07-05 16:49:55 +02:00
parent 4e9fc7dba7
commit 7443c95553
167 changed files with 1049 additions and 813 deletions

View file

@ -136,7 +136,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
AllGuiTextures heatBar = noHeat ? AllGuiTextures.JEI_NO_HEAT_BAR : AllGuiTextures.JEI_HEAT_BAR; AllGuiTextures heatBar = noHeat ? AllGuiTextures.JEI_NO_HEAT_BAR : AllGuiTextures.JEI_HEAT_BAR;
heatBar.render(matrixStack, 4, 80); heatBar.render(matrixStack, 4, 80);
Minecraft.getInstance().font.draw(matrixStack, Lang.translate(requiredHeat.getTranslationKey()), 9, Minecraft.getInstance().font.draw(matrixStack, Lang.translateDirect(requiredHeat.getTranslationKey()), 9,
86, requiredHeat.getColor()); 86, requiredHeat.getColor());
} }

View file

@ -77,7 +77,7 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
@Override @Override
public Component getTitle() { public Component getTitle() {
return Lang.translate("recipe." + name); return Lang.translateDirect("recipe." + name);
} }
@Override @Override
@ -125,7 +125,7 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
return (view, tooltip) -> { return (view, tooltip) -> {
float chance = output.getChance(); float chance = output.getChance();
if (chance != 1) if (chance != 1)
tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100)) tooltip.add(1, Lang.translateDirect("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100))
.withStyle(ChatFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
}; };
} }
@ -168,7 +168,7 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
} }
int amount = mbAmount == -1 ? fluidStack.getAmount() : mbAmount; int amount = mbAmount == -1 ? fluidStack.getAmount() : mbAmount;
Component text = new TextComponent(String.valueOf(amount)).append(Lang.translate("generic.unit.millibuckets")).withStyle(ChatFormatting.GOLD); Component text = new TextComponent(String.valueOf(amount)).append(Lang.translateDirect("generic.unit.millibuckets")).withStyle(ChatFormatting.GOLD);
if (tooltip.isEmpty()) if (tooltip.isEmpty())
tooltip.add(0, text); tooltip.add(0, text);
else { else {

View file

@ -47,7 +47,7 @@ public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationR
.addTooltipCallback(addStochasticTooltip(recipe.getRollableResults().get(0))); .addTooltipCallback(addStochasticTooltip(recipe.getRollableResults().get(0)));
if (recipe.shouldKeepHeldItem()) { if (recipe.shouldKeepHeldItem()) {
handItemSlot.addTooltipCallback((recipeSlotView, tooltip) -> tooltip.add(1, Lang.translate("recipe.deploying.not_consumed").withStyle(ChatFormatting.GOLD))); handItemSlot.addTooltipCallback((recipeSlotView, tooltip) -> tooltip.add(1, Lang.translateDirect("recipe.deploying.not_consumed").withStyle(ChatFormatting.GOLD)));
} }
} }

View file

@ -47,7 +47,7 @@ public class ItemApplicationCategory extends CreateRecipeCategory<ItemApplicatio
.addIngredients(recipe.getRequiredHeldItem()) .addIngredients(recipe.getRequiredHeldItem())
.addTooltipCallback( .addTooltipCallback(
recipe.shouldKeepHeldItem() recipe.shouldKeepHeldItem()
? (view, tooltip) -> tooltip.add(1, Lang.translate("recipe.deploying.not_consumed") ? (view, tooltip) -> tooltip.add(1, Lang.translateDirect("recipe.deploying.not_consumed")
.withStyle(ChatFormatting.GOLD)) .withStyle(ChatFormatting.GOLD))
: (view, tooltip) -> {} : (view, tooltip) -> {}
); );

View file

@ -38,7 +38,7 @@ public abstract class ProcessingViaFanCategory<T extends Recipe<?>> extends Crea
public static Supplier<ItemStack> getFan(String name) { public static Supplier<ItemStack> getFan(String name) {
return () -> AllBlocks.ENCASED_FAN.asStack() return () -> AllBlocks.ENCASED_FAN.asStack()
.setHoverName(Lang.translate("recipe." + name + ".fan").withStyle(style -> style.withItalic(false))); .setHoverName(Lang.translateDirect("recipe." + name + ".fan").withStyle(style -> style.withItalic(false)));
} }
@Override @Override

View file

@ -63,7 +63,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
return; return;
float chance = recipe.getOutputChance(); float chance = recipe.getOutputChance();
tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100)) tooltip.add(1, Lang.translateDirect("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100))
.withStyle(ChatFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
}); });
@ -151,7 +151,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
public List<Component> getTooltipStrings(SequencedAssemblyRecipe recipe, IRecipeSlotsView iRecipeSlotsView, double mouseX, double mouseY) { public List<Component> getTooltipStrings(SequencedAssemblyRecipe recipe, IRecipeSlotsView iRecipeSlotsView, double mouseX, double mouseY) {
List<Component> tooltip = new ArrayList<>(); List<Component> tooltip = new ArrayList<>();
TranslatableComponent junk = Lang.translate("recipe.assembly.junk"); TranslatableComponent junk = Lang.translateDirect("recipe.assembly.junk");
boolean singleOutput = recipe.getOutputChance() == 1; boolean singleOutput = recipe.getOutputChance() == 1;
boolean willRepeat = recipe.getLoops() > 1; boolean willRepeat = recipe.getLoops() > 1;
@ -164,7 +164,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
if (!singleOutput && mouseX >= minX && mouseX < maxX && mouseY >= minY && mouseY < maxY) { if (!singleOutput && mouseX >= minX && mouseX < maxX && mouseY >= minY && mouseY < maxY) {
float chance = recipe.getOutputChance(); float chance = recipe.getOutputChance();
tooltip.add(junk); tooltip.add(junk);
tooltip.add(Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : 100 - (int) (chance * 100)) tooltip.add(Lang.translateDirect("recipe.processing.chance", chance < 0.01 ? "<1" : 100 - (int) (chance * 100))
.withStyle(ChatFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
return tooltip; return tooltip;
} }
@ -174,7 +174,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
minY = 92; minY = 92;
maxY = minY + 24; maxY = minY + 24;
if (willRepeat && mouseX >= minX && mouseX < maxX && mouseY >= minY && mouseY < maxY) { if (willRepeat && mouseX >= minX && mouseX < maxX && mouseY >= minY && mouseY < maxY) {
tooltip.add(Lang.translate("recipe.assembly.repeat", recipe.getLoops())); tooltip.add(Lang.translateDirect("recipe.assembly.repeat", recipe.getLoops()));
return tooltip; return tooltip;
} }
@ -192,7 +192,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
SequencedRecipe<?> sequencedRecipe = sequence.get(i); SequencedRecipe<?> sequencedRecipe = sequence.get(i);
SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe); SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe);
if (relativeX >= 0 && relativeX < subCategory.getWidth()) { if (relativeX >= 0 && relativeX < subCategory.getWidth()) {
tooltip.add(Lang.translate("recipe.assembly.step", i + 1)); tooltip.add(Lang.translateDirect("recipe.assembly.step", i + 1));
tooltip.add(sequencedRecipe.getAsAssemblyRecipe() tooltip.add(sequencedRecipe.getAsAssemblyRecipe()
.getDescriptionForAssembly() .getDescriptionForAssembly()
.plainCopy() .plainCopy()

View file

@ -111,7 +111,7 @@ public abstract class SequencedAssemblySubCategory {
if (recipe.getAsAssemblyRecipe() instanceof DeployerApplicationRecipe deployerRecipe && deployerRecipe.shouldKeepHeldItem()) { if (recipe.getAsAssemblyRecipe() instanceof DeployerApplicationRecipe deployerRecipe && deployerRecipe.shouldKeepHeldItem()) {
slot.addTooltipCallback( slot.addTooltipCallback(
(recipeSlotView, tooltip) -> tooltip.add(1, Lang.translate("recipe.deploying.not_consumed").withStyle(ChatFormatting.GOLD)) (recipeSlotView, tooltip) -> tooltip.add(1, Lang.translateDirect("recipe.deploying.not_consumed").withStyle(ChatFormatting.GOLD))
); );
} }
} }

View file

@ -4,13 +4,13 @@ import java.util.List;
import com.simibubi.create.content.contraptions.KineticNetwork; import com.simibubi.create.content.contraptions.KineticNetwork;
import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.content.contraptions.base.IRotate.StressImpact;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent; import net.minecraft.util.Mth;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -57,31 +57,35 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
@Override @Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
boolean added = super.addToGoggleTooltip(tooltip, isPlayerSneaking); boolean added = super.addToGoggleTooltip(tooltip, isPlayerSneaking);
if (!StressImpact.isEnabled())
return added;
float stressBase = calculateAddedStressCapacity(); float stressBase = calculateAddedStressCapacity();
if (stressBase != 0 && IRotate.StressImpact.isEnabled()) { if (Mth.equal(stressBase, 0))
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.goggles.generator_stats"))); return added;
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("tooltip.capacityProvided").withStyle(ChatFormatting.GRAY)));
float speed = getTheoreticalSpeed(); Lang.translate("gui.goggles.generator_stats")
if (speed != getGeneratedSpeed() && speed != 0) .forGoggles(tooltip);
stressBase *= getGeneratedSpeed() / speed; Lang.translate("tooltip.capacityProvided")
.style(ChatFormatting.GRAY)
.forGoggles(tooltip);
speed = Math.abs(speed); float speed = getTheoreticalSpeed();
float stressTotal = stressBase * speed; if (speed != getGeneratedSpeed() && speed != 0)
stressBase *= getGeneratedSpeed() / speed;
speed = Math.abs(speed);
tooltip.add( float stressTotal = stressBase * speed;
componentSpacing.plainCopy()
.append(new TextComponent(" " + IHaveGoggleInformation.format(stressTotal))
.append(Lang.translate("generic.unit.stress"))
.withStyle(ChatFormatting.AQUA))
.append(" ")
.append(Lang.translate("gui.goggles.at_current_speed").withStyle(ChatFormatting.DARK_GRAY)));
added = true; Lang.number(stressTotal)
} .translate("generic.unit.stress")
.style(ChatFormatting.AQUA)
.space()
.add(Lang.translate("gui.goggles.at_current_speed")
.style(ChatFormatting.DARK_GRAY))
.forGoggles(tooltip, 1);
return added; return true;
} }
public void updateGeneratedRotation() { public void updateGeneratedRotation() {

View file

@ -1,18 +1,15 @@
package com.simibubi.create.content.contraptions.base; package com.simibubi.create.content.contraptions.base;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.item.ItemDescription; import com.simibubi.create.foundation.item.ItemDescription;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.LangBuilder;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -49,9 +46,11 @@ public interface IRotate extends IWrenchable {
public float getSpeedValue() { public float getSpeedValue() {
switch (this) { switch (this) {
case FAST: case FAST:
return AllConfigs.SERVER.kinetics.fastSpeed.get().floatValue(); return AllConfigs.SERVER.kinetics.fastSpeed.get()
.floatValue();
case MEDIUM: case MEDIUM:
return AllConfigs.SERVER.kinetics.mediumSpeed.get().floatValue(); return AllConfigs.SERVER.kinetics.mediumSpeed.get()
.floatValue();
case SLOW: case SLOW:
return 1; return 1;
case NONE: case NONE:
@ -72,19 +71,26 @@ public interface IRotate extends IWrenchable {
return NONE; return NONE;
} }
public static Component getFormattedSpeedText(float speed, boolean overstressed) { public static LangBuilder getFormattedSpeedText(float speed, boolean overstressed) {
SpeedLevel speedLevel = of(speed); SpeedLevel speedLevel = of(speed);
LangBuilder builder = Lang.text(ItemDescription.makeProgressBar(3, speedLevel.ordinal()));
MutableComponent level = new TextComponent(ItemDescription.makeProgressBar(3, speedLevel.ordinal())); builder.translate("tooltip.speedRequirement." + Lang.asId(speedLevel.name()))
level.append(Lang.translate("tooltip.speedRequirement." + Lang.asId(speedLevel.name()))); .space()
level.append(" (" + IHaveGoggleInformation.format(Math.abs(speed))).append(Lang.translate("generic.unit.rpm")).append(") "); .text("(")
.add(Lang.number(Math.abs(speed)))
.space()
.translate("generic.unit.rpm")
.text(")")
.space();
if (overstressed) if (overstressed)
level.withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.STRIKETHROUGH); builder.style(ChatFormatting.DARK_GRAY)
.style(ChatFormatting.STRIKETHROUGH);
else else
level.withStyle(speedLevel.getTextColor()); builder.style(speedLevel.getTextColor());
return level; return builder;
} }
} }
@ -125,14 +131,12 @@ public interface IRotate extends IWrenchable {
return !AllConfigs.SERVER.kinetics.disableStress.get(); return !AllConfigs.SERVER.kinetics.disableStress.get();
} }
public static Component getFormattedStressText(double stressPercent) { public static LangBuilder getFormattedStressText(double stressPercent) {
StressImpact stressLevel = of(stressPercent); StressImpact stressLevel = of(stressPercent);
return Lang.text(ItemDescription.makeProgressBar(3, Math.min(stressLevel.ordinal() + 1, 3)))
MutableComponent level = new TextComponent(ItemDescription.makeProgressBar(3, Math.min(stressLevel.ordinal() + 1, 3))); .translate("tooltip.stressImpact." + Lang.asId(stressLevel.name()))
level.append(Lang.translate("tooltip.stressImpact." + Lang.asId(stressLevel.name()))); .text(String.format(" (%s%%) ", (int) (stressPercent * 100)))
level.append(String.format(" (%s%%) ", (int) (stressPercent * 100))); .style(stressLevel.getRelativeColor());
return level.withStyle(stressLevel.getRelativeColor());
} }
} }

View file

@ -35,7 +35,6 @@ import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -46,8 +45,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
public class KineticTileEntity extends SmartTileEntity public class KineticTileEntity extends SmartTileEntity implements IHaveGoggleInformation, IHaveHoveringInformation {
implements IHaveGoggleInformation, IHaveHoveringInformation {
public @Nullable Long network; public @Nullable Long network;
public @Nullable BlockPos source; public @Nullable BlockPos source;
@ -93,7 +91,7 @@ public class KineticTileEntity extends SmartTileEntity
super.tick(); super.tick();
effects.tick(); effects.tick();
preventSpeedUpdate = 0; preventSpeedUpdate = 0;
if (level.isClientSide) { if (level.isClientSide) {
@ -399,9 +397,9 @@ public class KineticTileEntity extends SmartTileEntity
if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) { if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) {
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.stressometer.overstressed") .append(Lang.translateDirect("gui.stressometer.overstressed")
.withStyle(GOLD))); .withStyle(GOLD)));
Component hint = Lang.translate("gui.contraptions.network_overstressed"); Component hint = Lang.translateDirect("gui.contraptions.network_overstressed");
List<Component> cutString = TooltipHelper.cutTextComponent(hint, GRAY, ChatFormatting.WHITE); List<Component> cutString = TooltipHelper.cutTextComponent(hint, GRAY, ChatFormatting.WHITE);
for (int i = 0; i < cutString.size(); i++) for (int i = 0; i < cutString.size(); i++)
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
@ -411,10 +409,11 @@ public class KineticTileEntity extends SmartTileEntity
if (notFastEnough) { if (notFastEnough) {
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.speedRequirement") .append(Lang.translateDirect("tooltip.speedRequirement")
.withStyle(GOLD))); .withStyle(GOLD)));
Component hint = Lang.translate("gui.contraptions.not_fast_enough", I18n.get(getBlockState().getBlock() Component hint =
.getDescriptionId())); Lang.translateDirect("gui.contraptions.not_fast_enough", I18n.get(getBlockState().getBlock()
.getDescriptionId()));
List<Component> cutString = TooltipHelper.cutTextComponent(hint, GRAY, ChatFormatting.WHITE); List<Component> cutString = TooltipHelper.cutTextComponent(hint, GRAY, ChatFormatting.WHITE);
for (int i = 0; i < cutString.size(); i++) for (int i = 0; i < cutString.size(); i++)
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
@ -428,29 +427,30 @@ public class KineticTileEntity extends SmartTileEntity
@Override @Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
boolean added = false; boolean added = false;
if (!StressImpact.isEnabled())
return added;
float stressAtBase = calculateStressApplied(); float stressAtBase = calculateStressApplied();
if (Mth.equal(stressAtBase, 0))
return added;
if (calculateStressApplied() != 0 && StressImpact.isEnabled()) { Lang.translate("gui.goggles.kinetic_stats")
tooltip.add(componentSpacing.plainCopy() .forGoggles(tooltip);
.append(Lang.translate("gui.goggles.kinetic_stats"))); Lang.translate("tooltip.stressImpact")
tooltip.add(componentSpacing.plainCopy() .style(GRAY)
.append(Lang.translate("tooltip.stressImpact") .forGoggles(tooltip);
.withStyle(ChatFormatting.GRAY)));
float stressTotal = stressAtBase * Math.abs(getTheoreticalSpeed()); float stressTotal = stressAtBase * Math.abs(getTheoreticalSpeed());
tooltip.add(componentSpacing.plainCopy() Lang.number(stressTotal)
.append(new TextComponent(" " + IHaveGoggleInformation.format(stressTotal)) .translate("generic.unit.stress")
.append(Lang.translate("generic.unit.stress")) .style(ChatFormatting.AQUA)
.append(" ") .space()
.withStyle(ChatFormatting.AQUA)) .add(Lang.translate("gui.goggles.at_current_speed")
.append(Lang.translate("gui.goggles.at_current_speed") .style(ChatFormatting.DARK_GRAY))
.withStyle(ChatFormatting.DARK_GRAY))); .forGoggles(tooltip, 1);
added = true; return true;
}
return added;
} }
@ -582,7 +582,7 @@ public class KineticTileEntity extends SmartTileEntity
protected boolean isNoisy() { protected boolean isNoisy() {
return true; return true;
} }
public int getRotationAngleOffset(Axis axis) { public int getRotationAngleOffset(Axis axis) {
return 0; return 0;
} }

View file

@ -60,7 +60,7 @@ public class DeployerApplicationRecipe extends ItemApplicationRecipe implements
.getItems(); .getItems();
if (matchingStacks.length == 0) if (matchingStacks.length == 0)
return new TextComponent("Invalid"); return new TextComponent("Invalid");
return Lang.translate("recipe.assembly.deploying_item", return Lang.translateDirect("recipe.assembly.deploying_item",
new TranslatableComponent(matchingStacks[0].getDescriptionId()).getString()); new TranslatableComponent(matchingStacks[0].getDescriptionId()).getString());
} }

View file

@ -64,7 +64,7 @@ public class DeployerFakePlayer extends FakePlayer {
@Override @Override
public Component getDisplayName() { public Component getDisplayName() {
return Lang.translate("block.deployer.damage_source_name"); return Lang.translateDirect("block.deployer.damage_source_name");
} }
@Override @Override

View file

@ -32,11 +32,11 @@ public class CreativeMotorTileEntity extends GeneratingKineticTileEntity {
CenteredSideValueBoxTransform slot = new CenteredSideValueBoxTransform( CenteredSideValueBoxTransform slot = new CenteredSideValueBoxTransform(
(motor, side) -> motor.getValue(CreativeMotorBlock.FACING) == side.getOpposite()); (motor, side) -> motor.getValue(CreativeMotorBlock.FACING) == side.getOpposite());
generatedSpeed = new ScrollValueBehaviour(Lang.translate("generic.speed"), this, slot); generatedSpeed = new ScrollValueBehaviour(Lang.translateDirect("generic.speed"), this, slot);
generatedSpeed.between(-max, max); generatedSpeed.between(-max, max);
generatedSpeed.value = DEFAULT_SPEED; generatedSpeed.value = DEFAULT_SPEED;
generatedSpeed.scrollableValue = DEFAULT_SPEED; generatedSpeed.scrollableValue = DEFAULT_SPEED;
generatedSpeed.withUnit(i -> Lang.translate("generic.unit.rpm")); generatedSpeed.withUnit(i -> Lang.translateDirect("generic.unit.rpm"));
generatedSpeed.withCallback(i -> this.updateGeneratedRotation()); generatedSpeed.withCallback(i -> this.updateGeneratedRotation());
generatedSpeed.withStepFunction(CreativeMotorTileEntity::step); generatedSpeed.withStepFunction(CreativeMotorTileEntity::step);
behaviours.add(generatedSpeed); behaviours.add(generatedSpeed);

View file

@ -53,7 +53,7 @@ public class PressingRecipe extends ProcessingRecipe<RecipeWrapper> implements I
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public Component getDescriptionForAssembly() { public Component getDescriptionForAssembly() {
return Lang.translate("recipe.assembly.pressing"); return Lang.translateDirect("recipe.assembly.pressing");
} }
@Override @Override

View file

@ -53,7 +53,7 @@ public class CuttingRecipe extends ProcessingRecipe<RecipeWrapper> implements IA
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public Component getDescriptionForAssembly() { public Component getDescriptionForAssembly() {
return Lang.translate("recipe.assembly.cutting"); return Lang.translateDirect("recipe.assembly.cutting");
} }
@Override @Override

View file

@ -54,7 +54,7 @@ public class SteamEngineTileEntity extends SmartTileEntity implements IHaveGoggl
@Override @Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
movementDirection = new ScrollOptionBehaviour<>(RotationDirection.class, movementDirection = new ScrollOptionBehaviour<>(RotationDirection.class,
Lang.translate("contraptions.windmill.rotation_direction"), this, new SteamEngineValueBox()); Lang.translateDirect("contraptions.windmill.rotation_direction"), this, new SteamEngineValueBox());
movementDirection.requiresWrench(); movementDirection.requiresWrench();
movementDirection.onlyActiveWhen(() -> { movementDirection.onlyActiveWhen(() -> {
PoweredShaftTileEntity shaft = getShaft(); PoweredShaftTileEntity shaft = getShaft();

View file

@ -107,11 +107,11 @@ public class WhistleTileEntity extends SmartTileEntity implements IHaveGoggleInf
@Override @Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
String[] pitches = Lang.translate("generic.notes") String[] pitches = Lang.translateDirect("generic.notes")
.getString() .getString()
.split(";"); .split(";");
TextComponent textComponent = new TextComponent(spacing); TextComponent textComponent = new TextComponent(spacing);
tooltip.add(textComponent.append(Lang.translate("generic.pitch", pitches[pitch % pitches.length]))); tooltip.add(textComponent.append(Lang.translateDirect("generic.pitch", pitches[pitch % pitches.length])));
return true; return true;
} }

View file

@ -22,7 +22,7 @@ public interface IDisplayAssemblyExceptions {
tooltip.add(TextComponent.EMPTY); tooltip.add(TextComponent.EMPTY);
tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy() tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy()
.append(Lang.translate("gui.assembly.exception") .append(Lang.translateDirect("gui.assembly.exception")
.withStyle(ChatFormatting.GOLD))); .withStyle(ChatFormatting.GOLD)));
String text = e.component.getString(); String text = e.component.getString();

View file

@ -54,7 +54,7 @@ public class ClockworkBearingTileEntity extends KineticTileEntity
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
super.addBehaviours(behaviours); super.addBehaviours(behaviours);
operationMode = new ScrollOptionBehaviour<>(ClockHands.class, operationMode = new ScrollOptionBehaviour<>(ClockHands.class,
Lang.translate("contraptions.clockwork.clock_hands"), this, getMovementModeSlot()); Lang.translateDirect("contraptions.clockwork.clock_hands"), this, getMovementModeSlot());
operationMode.requiresWrench(); operationMode.requiresWrench();
behaviours.add(operationMode); behaviours.add(operationMode);
registerAwardables(behaviours, AllAdvancements.CLOCKWORK_BEARING); registerAwardables(behaviours, AllAdvancements.CLOCKWORK_BEARING);

View file

@ -51,7 +51,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity
@Override @Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
super.addBehaviours(behaviours); super.addBehaviours(behaviours);
movementMode = new ScrollOptionBehaviour<>(RotationMode.class, Lang.translate("contraptions.movement_mode"), movementMode = new ScrollOptionBehaviour<>(RotationMode.class, Lang.translateDirect("contraptions.movement_mode"),
this, getMovementModeSlot()); this, getMovementModeSlot());
movementMode.requiresWrench(); movementMode.requiresWrench();
behaviours.add(movementMode); behaviours.add(movementMode);

View file

@ -101,7 +101,7 @@ public class WindmillBearingTileEntity extends MechanicalBearingTileEntity {
super.addBehaviours(behaviours); super.addBehaviours(behaviours);
behaviours.remove(movementMode); behaviours.remove(movementMode);
movementDirection = new ScrollOptionBehaviour<>(RotationDirection.class, movementDirection = new ScrollOptionBehaviour<>(RotationDirection.class,
Lang.translate("contraptions.windmill.rotation_direction"), this, getMovementModeSlot()); Lang.translateDirect("contraptions.windmill.rotation_direction"), this, getMovementModeSlot());
movementDirection.requiresWrench(); movementDirection.requiresWrench();
movementDirection.withCallback($ -> onDirectionChanged()); movementDirection.withCallback($ -> onDirectionChanged());
behaviours.add(movementDirection); behaviours.add(movementDirection);

View file

@ -41,7 +41,7 @@ public class ChassisTileEntity extends SmartTileEntity {
@Override @Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
int max = AllConfigs.SERVER.kinetics.maxChassisRange.get(); int max = AllConfigs.SERVER.kinetics.maxChassisRange.get();
range = new BulkScrollValueBehaviour(Lang.translate("generic.range"), this, new CenteredSideValueBoxTransform(), range = new BulkScrollValueBehaviour(Lang.translateDirect("generic.range"), this, new CenteredSideValueBoxTransform(),
te -> ((ChassisTileEntity) te).collectChassisGroup()); te -> ((ChassisTileEntity) te).collectChassisGroup());
range.requiresWrench(); range.requiresWrench();
range.between(1, max); range.between(1, max);
@ -56,7 +56,7 @@ public class ChassisTileEntity extends SmartTileEntity {
public void initialize() { public void initialize() {
super.initialize(); super.initialize();
if (getBlockState().getBlock() instanceof RadialChassisBlock) if (getBlockState().getBlock() instanceof RadialChassisBlock)
range.setLabel(Lang.translate("generic.radius")); range.setLabel(Lang.translateDirect("generic.radius"));
} }
public int getRange() { public int getRange() {

View file

@ -40,7 +40,7 @@ public class ControlsHandler {
controlsPos = controllerLocalPos; controlsPos = controllerLocalPos;
Minecraft.getInstance().player.displayClientMessage( Minecraft.getInstance().player.displayClientMessage(
Lang.translate("contraption.controls.start_controlling", entity.getContraptionName()), true); Lang.translateDirect("contraption.controls.start_controlling", entity.getContraptionName()), true);
} }
public static void stopControlling() { public static void stopControlling() {
@ -57,7 +57,7 @@ public class ControlsHandler {
controlsPos = null; controlsPos = null;
currentlyPressed.clear(); currentlyPressed.clear();
Minecraft.getInstance().player.displayClientMessage(Lang.translate("contraption.controls.stop_controlling"), Minecraft.getInstance().player.displayClientMessage(Lang.translateDirect("contraption.controls.stop_controlling"),
true); true);
} }

View file

@ -234,7 +234,7 @@ public class CartAssemblerTileEntity extends SmartTileEntity implements IDisplay
@Override @Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
movementMode = new ScrollOptionBehaviour<>(CartMovementMode.class, movementMode = new ScrollOptionBehaviour<>(CartMovementMode.class,
Lang.translate("contraptions.cart_movement_mode"), this, getMovementModeSlot()); Lang.translateDirect("contraptions.cart_movement_mode"), this, getMovementModeSlot());
movementMode.requiresWrench(); movementMode.requiresWrench();
behaviours.add(movementMode); behaviours.add(movementMode);
registerAwardables(behaviours, AllAdvancements.CONTRAPTION_ACTORS); registerAwardables(behaviours, AllAdvancements.CONTRAPTION_ACTORS);

View file

@ -218,7 +218,7 @@ public class MinecartContraptionItem extends Item {
OrientedContraptionEntity contraption = (OrientedContraptionEntity) passengers.get(0); OrientedContraptionEntity contraption = (OrientedContraptionEntity) passengers.get(0);
if(ContraptionMovementSetting.isNoPickup(contraption.getContraption().getBlocks().values())) { if(ContraptionMovementSetting.isNoPickup(contraption.getContraption().getBlocks().values())) {
player.displayClientMessage(Lang.translate("contraption.minecart_contraption_illegal_pickup") player.displayClientMessage(Lang.translateDirect("contraption.minecart_contraption_illegal_pickup")
.withStyle(ChatFormatting.RED), true); .withStyle(ChatFormatting.RED), true);
return; return;
} }
@ -236,7 +236,7 @@ public class MinecartContraptionItem extends Item {
NbtIo.write(generatedStack.serializeNBT(), dataOutput); NbtIo.write(generatedStack.serializeNBT(), dataOutput);
int estimatedPacketSize = dataOutput.toByteArray().length; int estimatedPacketSize = dataOutput.toByteArray().length;
if (estimatedPacketSize > 2_000_000) { if (estimatedPacketSize > 2_000_000) {
player.displayClientMessage(Lang.translate("contraption.minecart_contraption_too_big") player.displayClientMessage(Lang.translateDirect("contraption.minecart_contraption_too_big")
.withStyle(ChatFormatting.RED), true); .withStyle(ChatFormatting.RED), true);
return; return;
} }

View file

@ -49,7 +49,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
@Override @Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
super.addBehaviours(behaviours); super.addBehaviours(behaviours);
movementMode = new ScrollOptionBehaviour<>(MovementMode.class, Lang.translate("contraptions.movement_mode"), movementMode = new ScrollOptionBehaviour<>(MovementMode.class, Lang.translateDirect("contraptions.movement_mode"),
this, getMovementModeSlot()); this, getMovementModeSlot());
movementMode.requiresWrench(); movementMode.requiresWrench();
movementMode.withCallback(t -> waitingForSpeedChange = false); movementMode.withCallback(t -> waitingForSpeedChange = false);

View file

@ -177,7 +177,7 @@ public class CouplingHandler {
public static void status(Player player, String key) { public static void status(Player player, String key) {
if (player == null) if (player == null)
return; return;
player.displayClientMessage(Lang.translate("minecart_coupling." + key), true); player.displayClientMessage(Lang.translateDirect("minecart_coupling." + key), true);
} }
} }

View file

@ -72,7 +72,7 @@ public class FillingRecipe extends ProcessingRecipe<RecipeWrapper> implements IA
.getMatchingFluidStacks(); .getMatchingFluidStacks();
if (matchingFluidStacks.size() == 0) if (matchingFluidStacks.size() == 0)
return new TextComponent("Invalid"); return new TextComponent("Invalid");
return Lang.translate("recipe.assembly.spout_filling_fluid", return Lang.translateDirect("recipe.assembly.spout_filling_fluid",
new TranslatableComponent(matchingFluidStacks.get(0) new TranslatableComponent(matchingFluidStacks.get(0)
.getTranslationKey()).getString()); .getTranslationKey()).getString());
} }

View file

@ -150,7 +150,8 @@ public class BoilerData {
calcMinMaxForSize(boilerSize); calcMinMaxForSize(boilerSize);
tooltip.add(indent.plainCopy() tooltip.add(indent.plainCopy()
.append(Lang.translate("boiler.status", getHeatLevelTextComponent().withStyle(ChatFormatting.GREEN)))); .append(
Lang.translateDirect("boiler.status", getHeatLevelTextComponent().withStyle(ChatFormatting.GREEN))));
tooltip.add(indent2.plainCopy() tooltip.add(indent2.plainCopy()
.append(getSizeComponent(true, false))); .append(getSizeComponent(true, false)));
tooltip.add(indent2.plainCopy() tooltip.add(indent2.plainCopy()
@ -162,22 +163,22 @@ public class BoilerData {
return true; return true;
int boilerLevel = Math.min(activeHeat, Math.min(maxHeatForWater, maxHeatForSize)); int boilerLevel = Math.min(activeHeat, Math.min(maxHeatForWater, maxHeatForSize));
double totalSU = getEngineEfficiency(boilerSize) * 16 * Math.max(boilerLevel, attachedEngines) double totalSU = getEngineEfficiency(boilerSize) * 16 * Math.max(boilerLevel, attachedEngines)
* BlockStressValues.getCapacity(AllBlocks.STEAM_ENGINE.get()); * BlockStressValues.getCapacity(AllBlocks.STEAM_ENGINE.get());
Component capacity =
new TextComponent(IHaveGoggleInformation.format(totalSU)).append(Lang.translate("generic.unit.stress"))
.withStyle(ChatFormatting.AQUA);
Component engines = (attachedEngines == 1 ? Lang.translate("boiler.via_one_engine")
: Lang.translate("boiler.via_engines", attachedEngines)).withStyle(ChatFormatting.DARK_GRAY);
tooltip.add(indent); tooltip.add(Lang.empty());
tooltip.add(indent.plainCopy()
.append(Lang.translate("tooltip.capacityProvided") Lang.translate("tooltip.capacityProvided")
.withStyle(ChatFormatting.GRAY))); .style(ChatFormatting.GRAY)
tooltip.add(indent2.plainCopy() .forGoggles(tooltip);
.append(capacity)
.append(engines)); Lang.number(totalSU)
.translate("generic.unit.stress")
.style(ChatFormatting.AQUA)
.space()
.add((attachedEngines == 1 ? Lang.translate("boiler.via_one_engine")
: Lang.translate("boiler.via_engines", attachedEngines)).style(ChatFormatting.DARK_GRAY))
.forGoggles(tooltip, 1);
return true; return true;
} }
@ -194,10 +195,10 @@ public class BoilerData {
public MutableComponent getHeatLevelTextComponent() { public MutableComponent getHeatLevelTextComponent() {
int boilerLevel = Math.min(activeHeat, Math.min(maxHeatForWater, maxHeatForSize)); int boilerLevel = Math.min(activeHeat, Math.min(maxHeatForWater, maxHeatForSize));
return isPassive() ? Lang.translate("boiler.passive") return isPassive() ? Lang.translateDirect("boiler.passive")
: (boilerLevel == 0 ? Lang.translate("boiler.idle") : (boilerLevel == 0 ? Lang.translateDirect("boiler.idle")
: boilerLevel == 18 ? Lang.translate("boiler.max_lvl") : boilerLevel == 18 ? Lang.translateDirect("boiler.max_lvl")
: Lang.translate("boiler.lvl", IHaveGoggleInformation.format(boilerLevel))); : Lang.translateDirect("boiler.lvl", String.valueOf(boilerLevel)));
} }
public MutableComponent getSizeComponent(boolean forGoggles, boolean useBlocksAsBars, ChatFormatting... styles) { public MutableComponent getSizeComponent(boolean forGoggles, boolean useBlocksAsBars, ChatFormatting... styles) {
@ -222,9 +223,9 @@ public class BoilerData {
ChatFormatting style1 = styles.length >= 1 ? styles[0] : ChatFormatting.GRAY; ChatFormatting style1 = styles.length >= 1 ? styles[0] : ChatFormatting.GRAY;
ChatFormatting style2 = styles.length >= 2 ? styles[1] : ChatFormatting.DARK_GRAY; ChatFormatting style2 = styles.length >= 2 ? styles[1] : ChatFormatting.DARK_GRAY;
return Lang.translate("boiler." + label) return Lang.translateDirect("boiler." + label)
.withStyle(style1) .withStyle(style1)
.append(Lang.translate("boiler." + label + "_dots") .append(Lang.translateDirect("boiler." + label + "_dots")
.withStyle(style2)) .withStyle(style2))
.append(base); .append(base);
} }
@ -306,7 +307,7 @@ public class BoilerData {
if (AllBlocks.STEAM_WHISTLE.has(attachedState) if (AllBlocks.STEAM_WHISTLE.has(attachedState)
&& WhistleBlock.getAttachedDirection(attachedState) && WhistleBlock.getAttachedDirection(attachedState)
.getOpposite() == d) { .getOpposite() == d) {
if (level.getBlockEntity(attachedPos) instanceof WhistleTileEntity wte) if (level.getBlockEntity(attachedPos)instanceof WhistleTileEntity wte)
whistlePitches.add(wte.getPitchId()); whistlePitches.add(wte.getPitchId());
} }
} }

View file

@ -27,27 +27,27 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
Component componentSpacing = new TextComponent(" "); Component componentSpacing = new TextComponent(" ");
tooltip = new ArrayList<>(); tooltip = new ArrayList<>();
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.config.overlay1"))); .append(Lang.translateDirect("gui.config.overlay1")));
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.config.overlay2") .append(Lang.translateDirect("gui.config.overlay2")
.withStyle(ChatFormatting.GRAY))); .withStyle(ChatFormatting.GRAY)));
tooltip.add(TextComponent.EMPTY); tooltip.add(TextComponent.EMPTY);
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.config.overlay3"))); .append(Lang.translateDirect("gui.config.overlay3")));
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.config.overlay4"))); .append(Lang.translateDirect("gui.config.overlay4")));
tooltip.add(TextComponent.EMPTY); tooltip.add(TextComponent.EMPTY);
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.config.overlay5") .append(Lang.translateDirect("gui.config.overlay5")
.withStyle(ChatFormatting.GRAY))); .withStyle(ChatFormatting.GRAY)));
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.config.overlay6") .append(Lang.translateDirect("gui.config.overlay6")
.withStyle(ChatFormatting.GRAY))); .withStyle(ChatFormatting.GRAY)));
tooltip.add(TextComponent.EMPTY); tooltip.add(TextComponent.EMPTY);
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.config.overlay7"))); .append(Lang.translateDirect("gui.config.overlay7")));
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.config.overlay8"))); .append(Lang.translateDirect("gui.config.overlay8")));
} }
@Override @Override

View file

@ -143,7 +143,7 @@ public class GoggleOverlayRenderer {
tooltip.add(TextComponent.EMPTY); tooltip.add(TextComponent.EMPTY);
tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy() tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy()
.append(Lang.translate("gui.goggles.pole_length")) .append(Lang.translateDirect("gui.goggles.pole_length"))
.append(new TextComponent(" " + poles))); .append(new TextComponent(" " + poles)));
} }

View file

@ -1,17 +1,14 @@
package com.simibubi.create.content.contraptions.goggles; package com.simibubi.create.content.contraptions.goggles;
import java.text.NumberFormat;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Optional; import java.util.Optional;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.LangBuilder;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
@ -21,29 +18,30 @@ import net.minecraftforge.fluids.capability.IFluidHandler;
* */ * */
public interface IHaveGoggleInformation { public interface IHaveGoggleInformation {
Format numberFormat = new Format(); /**
* Use Lang.[...].forGoggles(list)
*/
String spacing = " "; String spacing = " ";
/**
* Use Lang.[...].forGoggles(list)
*/
@Deprecated
Component componentSpacing = new TextComponent(spacing); Component componentSpacing = new TextComponent(spacing);
/** /**
* this method will be called when looking at a TileEntity that implemented this * this method will be called when looking at a TileEntity that implemented this
* interface * interface
* *
* @return {@code true} if the tooltip creation was successful and should be displayed, * @return {@code true} if the tooltip creation was successful and should be
* or {@code false} if the overlay should not be displayed * displayed, or {@code false} if the overlay should not be displayed
* */ */
default boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking){ default boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
return false; return false;
} }
static String format(double d) { default boolean containedFluidTooltip(List<Component> tooltip, boolean isPlayerSneaking,
return numberFormat.get() LazyOptional<IFluidHandler> handler) {
.format(d).replace("\u00A0", " ");
}
default boolean containedFluidTooltip(List<Component> tooltip, boolean isPlayerSneaking, LazyOptional<IFluidHandler> handler) {
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.goggles.fluid_container")));
TranslatableComponent mb = Lang.translate("generic.unit.millibuckets");
Optional<IFluidHandler> resolve = handler.resolve(); Optional<IFluidHandler> resolve = handler.resolve();
if (!resolve.isPresent()) if (!resolve.isPresent())
return false; return false;
@ -52,7 +50,9 @@ public interface IHaveGoggleInformation {
if (tank.getTanks() == 0) if (tank.getTanks() == 0)
return false; return false;
Component indent = new TextComponent(spacing + " "); LangBuilder mb = Lang.translate("generic.unit.millibuckets");
Lang.translate("gui.goggles.fluid_container")
.forGoggles(tooltip);
boolean isEmpty = true; boolean isEmpty = true;
for (int i = 0; i < tank.getTanks(); i++) { for (int i = 0; i < tank.getTanks(); i++) {
@ -60,17 +60,19 @@ public interface IHaveGoggleInformation {
if (fluidStack.isEmpty()) if (fluidStack.isEmpty())
continue; continue;
Component fluidName = new TranslatableComponent(fluidStack.getTranslationKey()).withStyle(ChatFormatting.GRAY); Lang.fluidName(fluidStack)
Component contained = new TextComponent(format(fluidStack.getAmount())).append(mb).withStyle(ChatFormatting.GOLD); .style(ChatFormatting.GRAY)
Component slash = new TextComponent(" / ").withStyle(ChatFormatting.GRAY); .forGoggles(tooltip, 1);
Component capacity = new TextComponent(format(tank.getTankCapacity(i))).append(mb).withStyle(ChatFormatting.DARK_GRAY);
tooltip.add(indent.plainCopy() Lang.builder()
.append(fluidName)); .add(Lang.number(fluidStack.getAmount())
tooltip.add(indent.plainCopy() .add(mb)
.append(contained) .style(ChatFormatting.GOLD))
.append(slash) .text(ChatFormatting.GRAY, " / ")
.append(capacity)); .add(Lang.number(tank.getTankCapacity(i))
.add(mb)
.style(ChatFormatting.DARK_GRAY))
.forGoggles(tooltip, 1);
isEmpty = false; isEmpty = false;
} }
@ -80,39 +82,18 @@ public interface IHaveGoggleInformation {
tooltip.remove(tooltip.size() - 1); tooltip.remove(tooltip.size() - 1);
return true; return true;
} }
if (!isEmpty) if (!isEmpty)
return true; return true;
Component capacity = Lang.translate("gui.goggles.fluid_container.capacity").withStyle(ChatFormatting.GRAY); Lang.translate("gui.goggles.fluid_container.capacity")
Component amount = new TextComponent(format(tank.getTankCapacity(0))).append(mb).withStyle(ChatFormatting.GOLD); .add(Lang.number(tank.getTankCapacity(0))
.add(mb)
.style(ChatFormatting.GOLD))
.style(ChatFormatting.GRAY)
.forGoggles(tooltip, 1);
tooltip.add(indent.plainCopy()
.append(capacity)
.append(amount));
return true; return true;
} }
class Format {
private NumberFormat format = NumberFormat.getNumberInstance(Locale.ROOT);
private Format() {}
public NumberFormat get() {
return format;
}
public void update() {
format = NumberFormat.getInstance(Minecraft.getInstance()
.getLanguageManager()
.getSelected()
.getJavaLocale());
format.setMaximumFractionDigits(2);
format.setMinimumFractionDigits(0);
format.setGroupingUsed(true);
}
}
} }

View file

@ -240,9 +240,9 @@ public class SequencedAssemblyRecipe implements Recipe<RecipeWrapper> {
int step = sequencedAssemblyRecipe.getStep(stack); int step = sequencedAssemblyRecipe.getStep(stack);
int total = length * sequencedAssemblyRecipe.loops; int total = length * sequencedAssemblyRecipe.loops;
toolTip.add(new TextComponent("")); toolTip.add(new TextComponent(""));
toolTip.add(Lang.translate("recipe.sequenced_assembly") toolTip.add(Lang.translateDirect("recipe.sequenced_assembly")
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
toolTip.add(Lang.translate("recipe.assembly.progress", step, total) toolTip.add(Lang.translateDirect("recipe.assembly.progress", step, total)
.withStyle(ChatFormatting.DARK_GRAY)); .withStyle(ChatFormatting.DARK_GRAY));
int remaining = total - step; int remaining = total - step;
@ -253,7 +253,7 @@ public class SequencedAssemblyRecipe implements Recipe<RecipeWrapper> {
Component textComponent = sequencedRecipe.getAsAssemblyRecipe() Component textComponent = sequencedRecipe.getAsAssemblyRecipe()
.getDescriptionForAssembly(); .getDescriptionForAssembly();
if (i == 0) if (i == 0)
toolTip.add(Lang.translate("recipe.assembly.next", textComponent) toolTip.add(Lang.translateDirect("recipe.assembly.next", textComponent)
.withStyle(ChatFormatting.AQUA)); .withStyle(ChatFormatting.AQUA));
else else
toolTip.add(new TextComponent("-> ").append(textComponent) toolTip.add(new TextComponent("-> ").append(textComponent)

View file

@ -59,18 +59,18 @@ public class BlazeBurnerInteractionBehaviour extends MovingInteractionBehaviour
if (train.runtime.paused && !train.runtime.completed) { if (train.runtime.paused && !train.runtime.completed) {
train.runtime.paused = false; train.runtime.paused = false;
AllSoundEvents.CONFIRM.playOnServer(player.level, player.blockPosition(), 1, 1); AllSoundEvents.CONFIRM.playOnServer(player.level, player.blockPosition(), 1, 1);
player.displayClientMessage(Lang.translate("schedule.continued"), true); player.displayClientMessage(Lang.translateDirect("schedule.continued"), true);
return true; return true;
} }
if (!itemInHand.isEmpty()) { if (!itemInHand.isEmpty()) {
AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1); AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1);
player.displayClientMessage(Lang.translate("schedule.remove_with_empty_hand"), true); player.displayClientMessage(Lang.translateDirect("schedule.remove_with_empty_hand"), true);
return true; return true;
} }
AllSoundEvents.playItemPickup(player); AllSoundEvents.playItemPickup(player);
player.displayClientMessage(Lang.translate( player.displayClientMessage(Lang.translateDirect(
train.runtime.isAutoSchedule ? "schedule.auto_removed_from_train" : "schedule.removed_from_train"), train.runtime.isAutoSchedule ? "schedule.auto_removed_from_train" : "schedule.removed_from_train"),
true); true);
player.setItemInHand(activeHand, train.runtime.returnSchedule()); player.setItemInHand(activeHand, train.runtime.returnSchedule());
@ -86,21 +86,21 @@ public class BlazeBurnerInteractionBehaviour extends MovingInteractionBehaviour
if (schedule.entries.isEmpty()) { if (schedule.entries.isEmpty()) {
AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1); AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1);
player.displayClientMessage(Lang.translate("schedule.no_stops"), true); player.displayClientMessage(Lang.translateDirect("schedule.no_stops"), true);
return true; return true;
} }
train.runtime.setSchedule(schedule, false); train.runtime.setSchedule(schedule, false);
AllAdvancements.CONDUCTOR.awardTo(player); AllAdvancements.CONDUCTOR.awardTo(player);
AllSoundEvents.CONFIRM.playOnServer(player.level, player.blockPosition(), 1, 1); AllSoundEvents.CONFIRM.playOnServer(player.level, player.blockPosition(), 1, 1);
player.displayClientMessage(Lang.translate("schedule.applied_to_train") player.displayClientMessage(Lang.translateDirect("schedule.applied_to_train")
.withStyle(ChatFormatting.GREEN), true); .withStyle(ChatFormatting.GREEN), true);
itemInHand.shrink(1); itemInHand.shrink(1);
player.setItemInHand(activeHand, itemInHand.isEmpty() ? ItemStack.EMPTY : itemInHand); player.setItemInHand(activeHand, itemInHand.isEmpty() ? ItemStack.EMPTY : itemInHand);
return true; return true;
} }
player.displayClientMessage(Lang.translate("schedule.non_controlling_seat"), true); player.displayClientMessage(Lang.translateDirect("schedule.non_controlling_seat"), true);
AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1); AllSoundEvents.DENY.playOnServer(player.level, player.blockPosition(), 1, 1);
return true; return true;
} }

View file

@ -45,11 +45,11 @@ public class SpeedControllerTileEntity extends KineticTileEntity {
Integer max = AllConfigs.SERVER.kinetics.maxRotationSpeed.get(); Integer max = AllConfigs.SERVER.kinetics.maxRotationSpeed.get();
targetSpeed = targetSpeed =
new ScrollValueBehaviour(Lang.translate("generic.speed"), this, new ControllerValueBoxTransform()); new ScrollValueBehaviour(Lang.translateDirect("generic.speed"), this, new ControllerValueBoxTransform());
targetSpeed.between(-max, max); targetSpeed.between(-max, max);
targetSpeed.value = DEFAULT_SPEED; targetSpeed.value = DEFAULT_SPEED;
targetSpeed.moveText(new Vec3(9, 0, 10)); targetSpeed.moveText(new Vec3(9, 0, 10));
targetSpeed.withUnit(i -> Lang.translate("generic.unit.rpm")); targetSpeed.withUnit(i -> Lang.translateDirect("generic.unit.rpm"));
targetSpeed.withCallback(i -> this.updateTargetRotation()); targetSpeed.withCallback(i -> this.updateTargetRotation());
targetSpeed.withStepFunction(CreativeMotorTileEntity::step); targetSpeed.withStepFunction(CreativeMotorTileEntity::step);
behaviours.add(targetSpeed); behaviours.add(targetSpeed);

View file

@ -32,7 +32,7 @@ public enum InstructionSpeedModifiers {
static List<Component> getOptions() { static List<Component> getOptions() {
List<Component> options = new ArrayList<>(); List<Component> options = new ArrayList<>();
for (InstructionSpeedModifiers entry : values()) for (InstructionSpeedModifiers entry : values())
options.add(Lang.translate(entry.translationKey)); options.add(Lang.translateDirect(entry.translationKey));
return options; return options;
} }

View file

@ -33,7 +33,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
private Vector<Vector<ScrollInput>> inputs; private Vector<Vector<ScrollInput>> inputs;
public SequencedGearshiftScreen(SequencedGearshiftTileEntity te) { public SequencedGearshiftScreen(SequencedGearshiftTileEntity te) {
super(Lang.translate("gui.sequenced_gearshift.title")); super(Lang.translateDirect("gui.sequenced_gearshift.title"));
this.instructions = te.instructions; this.instructions = te.instructions;
this.pos = te.getBlockPos(); this.pos = te.getBlockPos();
compareTag = Instruction.serializeAll(instructions); compareTag = Instruction.serializeAll(instructions);
@ -78,13 +78,13 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
new SelectionScrollInput(x, y + rowHeight * row, 50, 18).forOptions(SequencerInstructions.getOptions()) new SelectionScrollInput(x, y + rowHeight * row, 50, 18).forOptions(SequencerInstructions.getOptions())
.calling(state -> instructionUpdated(index, state)) .calling(state -> instructionUpdated(index, state))
.setState(instruction.instruction.ordinal()) .setState(instruction.instruction.ordinal())
.titled(Lang.translate("gui.sequenced_gearshift.instruction")); .titled(Lang.translateDirect("gui.sequenced_gearshift.instruction"));
ScrollInput value = ScrollInput value =
new ScrollInput(x + 58, y + rowHeight * row, 28, 18).calling(state -> instruction.value = state); new ScrollInput(x + 58, y + rowHeight * row, 28, 18).calling(state -> instruction.value = state);
ScrollInput direction = new SelectionScrollInput(x + 88, y + rowHeight * row, 28, 18) ScrollInput direction = new SelectionScrollInput(x + 88, y + rowHeight * row, 28, 18)
.forOptions(InstructionSpeedModifiers.getOptions()) .forOptions(InstructionSpeedModifiers.getOptions())
.calling(state -> instruction.speedModifier = InstructionSpeedModifiers.values()[state]) .calling(state -> instruction.speedModifier = InstructionSpeedModifiers.values()[state])
.titled(Lang.translate("gui.sequenced_gearshift.speed")); .titled(Lang.translateDirect("gui.sequenced_gearshift.speed"));
rowInputs.add(type); rowInputs.add(type);
rowInputs.add(value); rowInputs.add(value);
@ -105,7 +105,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
value.active = value.visible = hasValue; value.active = value.visible = hasValue;
if (hasValue) if (hasValue)
value.withRange(1, def.maxValue + 1) value.withRange(1, def.maxValue + 1)
.titled(Lang.translate(def.parameterKey)) .titled(Lang.translateDirect(def.parameterKey))
.withShiftStep(def.shiftStep) .withShiftStep(def.shiftStep)
.setState(instruction.value) .setState(instruction.value)
.onChanged(); .onChanged();
@ -146,7 +146,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
SequencerInstructions def = instruction.instruction; SequencerInstructions def = instruction.instruction;
def.background.render(ms, x, y + 14 + yOffset, this); def.background.render(ms, x, y + 14 + yOffset, this);
label(ms, 36, yOffset - 3, Lang.translate(def.translationKey)); label(ms, 36, yOffset - 3, Lang.translateDirect(def.translationKey));
if (def.hasValueParameter) { if (def.hasValueParameter) {
String text = def.formatValue(instruction.value); String text = def.formatValue(instruction.value);
int stringWidth = font.width(text); int stringWidth = font.width(text);

View file

@ -48,13 +48,13 @@ public enum SequencerInstructions {
static List<Component> getOptions() { static List<Component> getOptions() {
List<Component> options = new ArrayList<>(); List<Component> options = new ArrayList<>();
for (SequencerInstructions entry : values()) for (SequencerInstructions entry : values())
options.add(Lang.translate(entry.descriptiveTranslationKey)); options.add(Lang.translateDirect(entry.descriptiveTranslationKey));
return options; return options;
} }
String formatValue(int value) { String formatValue(int value) {
if (this == TURN_ANGLE) if (this == TURN_ANGLE)
return value + Lang.translate("generic.unit.degrees").getString(); return value + Lang.translateDirect("generic.unit.degrees").getString();
if (this == TURN_DISTANCE) if (this == TURN_DISTANCE)
return value + "m"; return value + "m";
if (this == DELAY) { if (this == DELAY) {

View file

@ -470,7 +470,7 @@ public class BeltSlicer {
return; return;
if (feedback.langKey != null) if (feedback.langKey != null)
mc.player.displayClientMessage(Lang.translate(feedback.langKey) mc.player.displayClientMessage(Lang.translateDirect(feedback.langKey)
.withStyle(feedback.formatting), true); .withStyle(feedback.formatting), true);
else else
mc.player.displayClientMessage(new TextComponent(""), true); mc.player.displayClientMessage(new TextComponent(""), true);

View file

@ -48,7 +48,7 @@ public class GaugeTileEntity extends KineticTileEntity implements IHaveGoggleInf
@Override @Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.gauge.info_header"))); tooltip.add(componentSpacing.plainCopy().append(Lang.translateDirect("gui.gauge.info_header")));
return true; return true;
} }

View file

@ -27,8 +27,8 @@ public class SpeedGaugeTileEntity extends GaugeTileEntity {
dialTarget = getDialTarget(speed); dialTarget = getDialTarget(speed);
color = Color.mixColors(SpeedLevel.of(speed) color = Color.mixColors(SpeedLevel.of(speed)
.getColor(), 0xffffff, .25f); .getColor(), 0xffffff, .25f);
setChanged(); setChanged();
} }
@ -55,10 +55,11 @@ public class SpeedGaugeTileEntity extends GaugeTileEntity {
@Override @Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
super.addToGoggleTooltip(tooltip, isPlayerSneaking); super.addToGoggleTooltip(tooltip, isPlayerSneaking);
Lang.translate("gui.speedometer.title")
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.speedometer.title").withStyle(ChatFormatting.GRAY))); .style(ChatFormatting.GRAY)
tooltip.add(componentSpacing.plainCopy().append(SpeedLevel.getFormattedSpeedText(speed, isOverStressed()))); .forGoggles(tooltip);
SpeedLevel.getFormattedSpeedText(speed, isOverStressed())
.forGoggles(tooltip);
return true; return true;
} }
} }

View file

@ -3,20 +3,18 @@ package com.simibubi.create.content.contraptions.relays.gauge;
import java.util.List; import java.util.List;
import com.simibubi.create.content.contraptions.base.IRotate.StressImpact; import com.simibubi.create.content.contraptions.base.IRotate.StressImpact;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.advancement.AllAdvancements; import com.simibubi.create.foundation.advancement.AllAdvancements;
import com.simibubi.create.foundation.item.ItemDescription; import com.simibubi.create.foundation.item.ItemDescription;
import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.utility.Color; import com.simibubi.create.foundation.utility.Color;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.LangBuilder;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -83,37 +81,39 @@ public class StressGaugeTileEntity extends GaugeTileEntity {
double capacity = getNetworkCapacity(); double capacity = getNetworkCapacity();
double stressFraction = getNetworkStress() / (capacity == 0 ? 1 : capacity); double stressFraction = getNetworkStress() / (capacity == 0 ? 1 : capacity);
tooltip.add(componentSpacing.plainCopy() Lang.translate("gui.stressometer.title")
.append(Lang.translate("gui.stressometer.title") .style(ChatFormatting.GRAY)
.withStyle(ChatFormatting.GRAY))); .forGoggles(tooltip);
if (getTheoreticalSpeed() == 0) if (getTheoreticalSpeed() == 0)
tooltip.add(new TextComponent(spacing + ItemDescription.makeProgressBar(3, 0)) Lang.text(ItemDescription.makeProgressBar(3, 0))
.append(Lang.translate("gui.stressometer.no_rotation")) .translate("gui.stressometer.no_rotation")
.withStyle(ChatFormatting.DARK_GRAY)); .style(ChatFormatting.DARK_GRAY)
.forGoggles(tooltip);
else { else {
tooltip.add(componentSpacing.plainCopy() StressImpact.getFormattedStressText(stressFraction)
.append(StressImpact.getFormattedStressText(stressFraction))); .forGoggles(tooltip);
Lang.translate("gui.stressometer.capacity")
tooltip.add(componentSpacing.plainCopy() .style(ChatFormatting.GRAY)
.append(Lang.translate("gui.stressometer.capacity") .forGoggles(tooltip);
.withStyle(ChatFormatting.GRAY)));
double remainingCapacity = capacity - getNetworkStress(); double remainingCapacity = capacity - getNetworkStress();
Component su = Lang.translate("generic.unit.stress"); LangBuilder su = Lang.translate("generic.unit.stress");
MutableComponent stressTooltip = componentSpacing.plainCopy() LangBuilder stressTip = Lang.number(remainingCapacity)
.append(new TextComponent(" " + IHaveGoggleInformation.format(remainingCapacity)).append(su.plainCopy()) .add(su)
.withStyle(StressImpact.of(stressFraction) .style(StressImpact.of(stressFraction)
.getRelativeColor())); .getRelativeColor());
if (remainingCapacity != capacity) {
stressTooltip.append(new TextComponent(" / ").withStyle(ChatFormatting.GRAY)) if (remainingCapacity != capacity)
.append(new TextComponent(IHaveGoggleInformation.format(capacity)).append(su.plainCopy()) stressTip.text(ChatFormatting.GRAY, " / ")
.withStyle(ChatFormatting.DARK_GRAY)); .add(Lang.number(capacity)
} .add(su)
tooltip.add(stressTooltip); .style(ChatFormatting.DARK_GRAY));
stressTip.forGoggles(tooltip, 1);
} }
if (!worldPosition.equals(lastSent)) if (!worldPosition.equals(lastSent))
AllPackets.channel.sendToServer(new GaugeObservedPacket(lastSent = worldPosition)); AllPackets.channel.sendToServer(new GaugeObservedPacket(lastSent = worldPosition));

View file

@ -63,7 +63,7 @@ public class BackTankUtil {
return; return;
boolean depleted = threshold == 1; boolean depleted = threshold == 1;
MutableComponent component = Lang.translate(depleted ? "backtank.depleted" : "backtank.low"); MutableComponent component = Lang.translateDirect(depleted ? "backtank.depleted" : "backtank.low");
AllSoundEvents.DENY.play(player.level, null, player.blockPosition(), 1, 1.25f); AllSoundEvents.DENY.play(player.level, null, player.blockPosition(), 1, 1.25f);
AllSoundEvents.STEAM.play(player.level, null, player.blockPosition(), .5f, .5f); AllSoundEvents.STEAM.play(player.level, null, player.blockPosition(), .5f, .5f);

View file

@ -34,8 +34,8 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
private Label labelAlign; private Label labelAlign;
private IconButton confirmButton; private IconButton confirmButton;
private final Component mirrorType = Lang.translate("gui.symmetryWand.mirrorType"); private final Component mirrorType = Lang.translateDirect("gui.symmetryWand.mirrorType");
private final Component orientation = Lang.translate("gui.symmetryWand.orientation"); private final Component orientation = Lang.translateDirect("gui.symmetryWand.orientation");
private SymmetryMirror currentElement; private SymmetryMirror currentElement;
private ItemStack wand; private ItemStack wand;

View file

@ -105,7 +105,7 @@ public class CrossPlaneMirror extends SymmetryMirror {
@Override @Override
public List<Component> getAlignToolTips() { public List<Component> getAlignToolTips() {
return ImmutableList.of(Lang.translate("orientation.orthogonal"), Lang.translate("orientation.diagonal")); return ImmutableList.of(Lang.translateDirect("orientation.orthogonal"), Lang.translateDirect("orientation.diagonal"));
} }
} }

View file

@ -101,7 +101,7 @@ public class PlaneMirror extends SymmetryMirror {
@Override @Override
public List<Component> getAlignToolTips() { public List<Component> getAlignToolTips() {
return ImmutableList.of(Lang.translate("orientation.alongZ"), Lang.translate("orientation.alongX")); return ImmutableList.of(Lang.translateDirect("orientation.alongZ"), Lang.translateDirect("orientation.alongX"));
} }
} }

View file

@ -45,8 +45,8 @@ public abstract class SymmetryMirror {
} }
public static List<Component> getMirrors() { public static List<Component> getMirrors() {
return ImmutableList.of(Lang.translate("symmetry.mirror.plane"), Lang.translate("symmetry.mirror.doublePlane"), return ImmutableList.of(Lang.translateDirect("symmetry.mirror.plane"), Lang.translateDirect("symmetry.mirror.doublePlane"),
Lang.translate("symmetry.mirror.triplePlane")); Lang.translateDirect("symmetry.mirror.triplePlane"));
} }
public StringRepresentable getOrientation() { public StringRepresentable getOrientation() {

View file

@ -66,7 +66,7 @@ public class TriplePlaneMirror extends SymmetryMirror {
@Override @Override
public List<Component> getAlignToolTips() { public List<Component> getAlignToolTips() {
return ImmutableList.of(Lang.translate("orientation.horizontal")); return ImmutableList.of(Lang.translateDirect("orientation.horizontal"));
} }
} }

View file

@ -81,7 +81,7 @@ public class RadialToolboxMenu extends AbstractSimiScreen {
if (state == State.DETACH) { if (state == State.DETACH) {
tip = Lang.translate("toolbox.outOfRange"); tip = Lang.translateDirect("toolbox.outOfRange");
if (hoveredX > -20 && hoveredX < 20 && hoveredY > -80 && hoveredY < -20) if (hoveredX > -20 && hoveredX < 20 && hoveredY > -80 && hoveredY < -20)
hoveredSlot = UNEQUIP; hoveredSlot = UNEQUIP;
@ -99,7 +99,7 @@ public class RadialToolboxMenu extends AbstractSimiScreen {
ms.translate(0.5, -0.5, 0); ms.translate(0.5, -0.5, 0);
if (!scrollMode && hoveredSlot == UNEQUIP) { if (!scrollMode && hoveredSlot == UNEQUIP) {
AllGuiTextures.TOOLBELT_SLOT_HIGHLIGHT.render(ms, -13, -13, this); AllGuiTextures.TOOLBELT_SLOT_HIGHLIGHT.render(ms, -13, -13, this);
tip = Lang.translate("toolbox.detach") tip = Lang.translateDirect("toolbox.detach")
.withStyle(ChatFormatting.GOLD); .withStyle(ChatFormatting.GOLD);
} }
ms.popPose(); ms.popPose();
@ -117,7 +117,7 @@ public class RadialToolboxMenu extends AbstractSimiScreen {
ms.translate(0.5, -0.5, 0); ms.translate(0.5, -0.5, 0);
if (!scrollMode && hoveredSlot == DEPOSIT) { if (!scrollMode && hoveredSlot == DEPOSIT) {
AllGuiTextures.TOOLBELT_SLOT_HIGHLIGHT.render(ms, -13, -13, this); AllGuiTextures.TOOLBELT_SLOT_HIGHLIGHT.render(ms, -13, -13, this);
tip = Lang.translate(state == State.SELECT_BOX ? "toolbox.depositAll" : "toolbox.depositBox") tip = Lang.translateDirect(state == State.SELECT_BOX ? "toolbox.depositAll" : "toolbox.depositBox")
.withStyle(ChatFormatting.GOLD); .withStyle(ChatFormatting.GOLD);
} }
ms.popPose(); ms.popPose();
@ -179,7 +179,7 @@ public class RadialToolboxMenu extends AbstractSimiScreen {
(scrollMode ? AllIcons.I_REFRESH : AllIcons.I_FLIP).render(ms, -9, -9, this); (scrollMode ? AllIcons.I_REFRESH : AllIcons.I_FLIP).render(ms, -9, -9, this);
if (!scrollMode && UNEQUIP == hoveredSlot) { if (!scrollMode && UNEQUIP == hoveredSlot) {
AllGuiTextures.TOOLBELT_SLOT_HIGHLIGHT.render(ms, -13, -13, this); AllGuiTextures.TOOLBELT_SLOT_HIGHLIGHT.render(ms, -13, -13, this);
tip = Lang.translate("toolbox.unequip", minecraft.player.getMainHandItem() tip = Lang.translateDirect("toolbox.unequip", minecraft.player.getMainHandItem()
.getHoverName()) .getHoverName())
.withStyle(ChatFormatting.GOLD); .withStyle(ChatFormatting.GOLD);
} }

View file

@ -60,7 +60,7 @@ public class ToolboxScreen extends AbstractSimiContainerScreen<ToolboxContainer>
disposeButton.withCallback(() -> { disposeButton.withCallback(() -> {
AllPackets.channel.sendToServer(new ToolboxDisposeAllPacket(menu.contentHolder.getBlockPos())); AllPackets.channel.sendToServer(new ToolboxDisposeAllPacket(menu.contentHolder.getBlockPos()));
}); });
disposeButton.setToolTip(Lang.translate("toolbox.depositBox")); disposeButton.setToolTip(Lang.translateDirect("toolbox.depositBox"));
addRenderableWidget(disposeButton); addRenderableWidget(disposeButton);
extraAreas = ImmutableList.of( extraAreas = ImmutableList.of(

View file

@ -61,9 +61,7 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
addRenderableWidget(resetButton); addRenderableWidget(resetButton);
addRenderableWidget(confirmButton); addRenderableWidget(confirmButton);
extraAreas = ImmutableList.of( extraAreas = ImmutableList.of(new Rect2i(x + background.width, y + background.height - 36, 56, 44));
new Rect2i(x + background.width, y + background.height - 36, 56, 44)
);
} }
@Override @Override
@ -78,8 +76,8 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
background.render(ms, x, y, this); background.render(ms, x, y, this);
font.draw(ms, title, x + 15, y + 4, 0xFFFFFF); font.draw(ms, title, x + 15, y + 4, 0xFFFFFF);
GuiGameElement.of(AllBlockPartials.CRAFTING_BLUEPRINT_1x1) GuiGameElement.of(AllBlockPartials.CRAFTING_BLUEPRINT_1x1).<GuiGameElement
.<GuiGameElement.GuiRenderBuilder>at(x + background.width + 20, y + background.height - 32, 0) .GuiRenderBuilder>at(x + background.width + 20, y + background.height - 32, 0)
.rotate(45, -45, 22.5f) .rotate(45, -45, 22.5f)
.scale(40) .scale(40)
.render(ms); .render(ms);
@ -93,8 +91,7 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
super.renderTooltip(ms, x, y); super.renderTooltip(ms, x, y);
return; return;
} }
renderComponentTooltip(ms, addToTooltip(new LinkedList<>(), hoveredSlot.getSlotIndex(), true), x, y, renderComponentTooltip(ms, addToTooltip(new LinkedList<>(), hoveredSlot.getSlotIndex(), true), x, y, font);
font);
} }
@Override @Override
@ -110,26 +107,26 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
return list; return list;
if (slot < 9) { if (slot < 9) {
list.add(Lang.createTranslationTextComponent("crafting_blueprint.crafting_slot") list.add(Lang.translateDirect("crafting_blueprint.crafting_slot")
.withStyle(ChatFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
if (isEmptySlot) if (isEmptySlot)
list.add(Lang.createTranslationTextComponent("crafting_blueprint.filter_items_viable") list.add(Lang.translateDirect("crafting_blueprint.filter_items_viable")
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
} else if (slot == 9) { } else if (slot == 9) {
list.add(Lang.createTranslationTextComponent("crafting_blueprint.display_slot") list.add(Lang.translateDirect("crafting_blueprint.display_slot")
.withStyle(ChatFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
if (!isEmptySlot) if (!isEmptySlot)
list.add(Lang list.add(Lang
.createTranslationTextComponent("crafting_blueprint." .translateDirect(
+ (menu.contentHolder.inferredIcon ? "inferred" : "manually_assigned")) "crafting_blueprint." + (menu.contentHolder.inferredIcon ? "inferred" : "manually_assigned"))
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
} else if (slot == 10) { } else if (slot == 10) {
list.add(Lang.createTranslationTextComponent("crafting_blueprint.secondary_display_slot") list.add(Lang.translateDirect("crafting_blueprint.secondary_display_slot")
.withStyle(ChatFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
if (isEmptySlot) if (isEmptySlot)
list.add(Lang.createTranslationTextComponent("crafting_blueprint.optional") list.add(Lang.translateDirect("crafting_blueprint.optional")
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
} }

View file

@ -242,13 +242,13 @@ public class PotatoCannonItem extends ProjectileWeaponItem {
reloadTicks = reloadTicks.withStyle(darkGreen); reloadTicks = reloadTicks.withStyle(darkGreen);
tooltip.add(spacing.plainCopy() tooltip.add(spacing.plainCopy()
.append(Lang.translate(_attack, damage) .append(Lang.translateDirect(_attack, damage)
.withStyle(darkGreen))); .withStyle(darkGreen)));
tooltip.add(spacing.plainCopy() tooltip.add(spacing.plainCopy()
.append(Lang.translate(_reload, reloadTicks) .append(Lang.translateDirect(_reload, reloadTicks)
.withStyle(darkGreen))); .withStyle(darkGreen)));
tooltip.add(spacing.plainCopy() tooltip.add(spacing.plainCopy()
.append(Lang.translate(_knockback, knockback) .append(Lang.translateDirect(_knockback, knockback)
.withStyle(darkGreen))); .withStyle(darkGreen)));
}); });
super.appendHoverText(stack, world, tooltip, flag); super.appendHoverText(stack, world, tooltip, flag);

View file

@ -59,7 +59,7 @@ public abstract class ZapperItem extends Item {
.getBlock() .getBlock()
.getDescriptionId(); .getDescriptionId();
ItemDescription.add(tooltip, ItemDescription.add(tooltip,
Lang.translate("terrainzapper.usingBlock", Lang.translateDirect("terrainzapper.usingBlock",
new TranslatableComponent(usedblock).withStyle(ChatFormatting.GRAY)) new TranslatableComponent(usedblock).withStyle(ChatFormatting.GRAY))
.withStyle(ChatFormatting.DARK_GRAY)); .withStyle(ChatFormatting.DARK_GRAY));
} }
@ -147,8 +147,8 @@ public abstract class ZapperItem extends Item {
.add(0, player.getEyeHeight(), 0); .add(0, player.getEyeHeight(), 0);
Vec3 range = player.getLookAngle() Vec3 range = player.getLookAngle()
.scale(getZappingRange(item)); .scale(getZappingRange(item));
BlockHitResult raytrace = world BlockHitResult raytrace =
.clip(new ClipContext(start, start.add(range), Block.OUTLINE, Fluid.NONE, player)); world.clip(new ClipContext(start, start.add(range), Block.OUTLINE, Fluid.NONE, player));
BlockPos pos = raytrace.getBlockPos(); BlockPos pos = raytrace.getBlockPos();
BlockState stateReplaced = world.getBlockState(pos); BlockState stateReplaced = world.getBlockState(pos);
@ -180,7 +180,7 @@ public abstract class ZapperItem extends Item {
public Component validateUsage(ItemStack item) { public Component validateUsage(ItemStack item) {
CompoundTag tag = item.getOrCreateTag(); CompoundTag tag = item.getOrCreateTag();
if (!canActivateWithoutSelectedBlock(item) && !tag.contains("BlockUsed")) if (!canActivateWithoutSelectedBlock(item) && !tag.contains("BlockUsed"))
return Lang.createTranslationTextComponent("terrainzapper.leftClickToSet"); return Lang.translateDirect("terrainzapper.leftClickToSet");
return null; return null;
} }

View file

@ -24,7 +24,7 @@ import net.minecraft.world.level.block.state.BlockState;
public abstract class ZapperScreen extends AbstractSimiScreen { public abstract class ZapperScreen extends AbstractSimiScreen {
protected final Component patternSection = Lang.translate("gui.terrainzapper.patternSection"); protected final Component patternSection = Lang.translateDirect("gui.terrainzapper.patternSection");
protected AllGuiTextures background; protected AllGuiTextures background;
protected ItemStack zapper; protected ItemStack zapper;
@ -81,7 +81,7 @@ public abstract class ZapperScreen extends AbstractSimiScreen {
patternButton.active = false; patternButton.active = false;
currentPattern = pattern; currentPattern = pattern;
}); });
patternButton.setToolTip(Lang.translate("gui.terrainzapper.pattern." + pattern.translationKey)); patternButton.setToolTip(Lang.translateDirect("gui.terrainzapper.pattern." + pattern.translationKey));
patternButtons.add(patternButton); patternButtons.add(patternButton);
} }
} }

View file

@ -53,7 +53,7 @@ public abstract class Brush {
Component getParamLabel(int paramIndex) { Component getParamLabel(int paramIndex) {
return Lang return Lang
.translate(paramIndex == 0 ? "generic.width" : paramIndex == 1 ? "generic.height" : "generic.length"); .translateDirect(paramIndex == 0 ? "generic.width" : paramIndex == 1 ? "generic.height" : "generic.length");
} }
public int get(int paramIndex) { public int get(int paramIndex) {

View file

@ -74,7 +74,7 @@ public class CylinderBrush extends ShapedBrush {
@Override @Override
Component getParamLabel(int paramIndex) { Component getParamLabel(int paramIndex) {
return paramIndex == 0 ? Lang.translate("generic.radius") : super.getParamLabel(paramIndex); return paramIndex == 0 ? Lang.translateDirect("generic.radius") : super.getParamLabel(paramIndex);
} }
@Override @Override

View file

@ -27,7 +27,7 @@ public class DynamicBrush extends Brush {
} }
Component getParamLabel(int paramIndex) { Component getParamLabel(int paramIndex) {
return Lang.translate("generic.range"); return Lang.translateDirect("generic.range");
} }
@Override @Override

View file

@ -51,7 +51,7 @@ public class SphereBrush extends ShapedBrush {
@Override @Override
Component getParamLabel(int paramIndex) { Component getParamLabel(int paramIndex) {
return Lang.translate("generic.radius"); return Lang.translateDirect("generic.radius");
} }
@Override @Override

View file

@ -51,7 +51,7 @@ public class WorldshaperItem extends ZapperItem {
public Component validateUsage(ItemStack item) { public Component validateUsage(ItemStack item) {
if (!item.getOrCreateTag() if (!item.getOrCreateTag()
.contains("BrushParams")) .contains("BrushParams"))
return Lang.createTranslationTextComponent("terrainzapper.shiftRightClickToSet"); return Lang.translateDirect("terrainzapper.shiftRightClickToSet");
return super.validateUsage(item); return super.validateUsage(item);
} }
@ -86,7 +86,8 @@ public class WorldshaperItem extends ZapperItem {
return true; return true;
} }
public static void configureSettings(ItemStack stack, PlacementPatterns pattern, TerrainBrushes brush, int brushParamX, int brushParamY, int brushParamZ, TerrainTools tool, PlacementOptions placement) { public static void configureSettings(ItemStack stack, PlacementPatterns pattern, TerrainBrushes brush,
int brushParamX, int brushParamY, int brushParamZ, TerrainTools tool, PlacementOptions placement) {
ZapperItem.configureSettings(stack, pattern); ZapperItem.configureSettings(stack, pattern);
CompoundTag nbt = stack.getOrCreateTag(); CompoundTag nbt = stack.getOrCreateTag();
NBTHelper.writeEnum(nbt, "Brush", brush); NBTHelper.writeEnum(nbt, "Brush", brush);

View file

@ -28,8 +28,8 @@ import net.minecraft.world.item.ItemStack;
public class WorldshaperScreen extends ZapperScreen { public class WorldshaperScreen extends ZapperScreen {
protected final Component placementSection = Lang.translate("gui.terrainzapper.placement"); protected final Component placementSection = Lang.translateDirect("gui.terrainzapper.placement");
protected final Component toolSection = Lang.translate("gui.terrainzapper.tool"); protected final Component toolSection = Lang.translateDirect("gui.terrainzapper.tool");
protected final List<Component> brushOptions = protected final List<Component> brushOptions =
Lang.translatedOptions("gui.terrainzapper.brush", "cuboid", "sphere", "cylinder", "surface", "cluster"); Lang.translatedOptions("gui.terrainzapper.brush", "cuboid", "sphere", "cylinder", "surface", "cluster");
@ -84,7 +84,7 @@ public class WorldshaperScreen extends ZapperScreen {
brushLabel = new Label(x + 61, y + 25, TextComponent.EMPTY).withShadow(); brushLabel = new Label(x + 61, y + 25, TextComponent.EMPTY).withShadow();
brushInput = new SelectionScrollInput(x + 56, y + 20, 77, 18).forOptions(brushOptions) brushInput = new SelectionScrollInput(x + 56, y + 20, 77, 18).forOptions(brushOptions)
.titled(Lang.translate("gui.terrainzapper.brush")) .titled(Lang.translateDirect("gui.terrainzapper.brush"))
.writingTo(brushLabel) .writingTo(brushLabel)
.calling(brushIndex -> { .calling(brushIndex -> {
currentBrush = TerrainBrushes.values()[brushIndex]; currentBrush = TerrainBrushes.values()[brushIndex];
@ -165,12 +165,12 @@ public class WorldshaperScreen extends ZapperScreen {
followDiagonalsIndicator.state = followDiagonalsIndicator.state == State.OFF ? State.ON : State.OFF; followDiagonalsIndicator.state = followDiagonalsIndicator.state == State.OFF ? State.ON : State.OFF;
currentFollowDiagonals = !currentFollowDiagonals; currentFollowDiagonals = !currentFollowDiagonals;
}); });
followDiagonals.setToolTip(Lang.translate("gui.terrainzapper.searchDiagonal")); followDiagonals.setToolTip(Lang.translateDirect("gui.terrainzapper.searchDiagonal"));
acrossMaterials.withCallback(() -> { acrossMaterials.withCallback(() -> {
acrossMaterialsIndicator.state = acrossMaterialsIndicator.state == State.OFF ? State.ON : State.OFF; acrossMaterialsIndicator.state = acrossMaterialsIndicator.state == State.OFF ? State.ON : State.OFF;
currentAcrossMaterials = !currentAcrossMaterials; currentAcrossMaterials = !currentAcrossMaterials;
}); });
acrossMaterials.setToolTip(Lang.translate("gui.terrainzapper.searchFuzzy")); acrossMaterials.setToolTip(Lang.translateDirect("gui.terrainzapper.searchFuzzy"));
addRenderableWidget(followDiagonals); addRenderableWidget(followDiagonals);
addRenderableWidget(followDiagonalsIndicator); addRenderableWidget(followDiagonalsIndicator);
addRenderableWidget(acrossMaterials); addRenderableWidget(acrossMaterials);
@ -196,7 +196,7 @@ public class WorldshaperScreen extends ZapperScreen {
toolButton.active = false; toolButton.active = false;
currentTool = tool; currentTool = tool;
}); });
toolButton.setToolTip(Lang.translate("gui.terrainzapper.tool." + tool.translationKey)); toolButton.setToolTip(Lang.translateDirect("gui.terrainzapper.tool." + tool.translationKey));
toolButtons.add(toolButton); toolButtons.add(toolButton);
} }
@ -228,7 +228,7 @@ public class WorldshaperScreen extends ZapperScreen {
placementButton.active = false; placementButton.active = false;
currentPlacement = option; currentPlacement = option;
}); });
placementButton.setToolTip(Lang.translate("gui.terrainzapper.placement." + option.translationKey)); placementButton.setToolTip(Lang.translateDirect("gui.terrainzapper.placement." + option.translationKey));
placementButtons.add(placementButton); placementButtons.add(placementButton);
} }

View file

@ -91,7 +91,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity implements IHave
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
super.addBehaviours(behaviours); super.addBehaviours(behaviours);
behaviours.add(selectionMode = new ScrollOptionBehaviour<>(SelectionMode.class, behaviours.add(selectionMode = new ScrollOptionBehaviour<>(SelectionMode.class,
Lang.translate("logistics.when_multiple_outputs_available"), this, Lang.translateDirect("logistics.when_multiple_outputs_available"), this,
new CenteredSideValueBoxTransform((state, d) -> d == Direction.UP))); new CenteredSideValueBoxTransform((state, d) -> d == Direction.UP)));
selectionMode.requiresWrench(); selectionMode.requiresWrench();
@ -748,16 +748,16 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity implements IHave
return false; return false;
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.brass_tunnel.contains")) .append(Lang.translateDirect("tooltip.brass_tunnel.contains"))
.withStyle(ChatFormatting.WHITE)); .withStyle(ChatFormatting.WHITE));
for (ItemStack item : allStacks) { for (ItemStack item : allStacks) {
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.brass_tunnel.contains_entry", new TranslatableComponent(item.getItem() .append(Lang.translateDirect("tooltip.brass_tunnel.contains_entry", new TranslatableComponent(item.getItem()
.getDescriptionId(item)).getString(), item.getCount())) .getDescriptionId(item)).getString(), item.getCount()))
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
} }
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.brass_tunnel.retrieve")) .append(Lang.translateDirect("tooltip.brass_tunnel.retrieve"))
.withStyle(ChatFormatting.DARK_GRAY)); .withStyle(ChatFormatting.DARK_GRAY));
return true; return true;

View file

@ -700,26 +700,26 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
boolean downward = getItemMotion() < 0; boolean downward = getItemMotion() < 0;
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.chute.header"))); .append(Lang.translateDirect("tooltip.chute.header")));
if (pull == 0 && push == 0) if (pull == 0 && push == 0)
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.chute.no_fans_attached")) .append(Lang.translateDirect("tooltip.chute.no_fans_attached"))
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
if (pull != 0) if (pull != 0)
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.chute.fans_" + (pull > 0 ? "pull_up" : "push_down")) .append(Lang.translateDirect("tooltip.chute.fans_" + (pull > 0 ? "pull_up" : "push_down"))
.withStyle(ChatFormatting.GRAY))); .withStyle(ChatFormatting.GRAY)));
if (push != 0) if (push != 0)
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.chute.fans_" + (push > 0 ? "push_up" : "pull_down")) .append(Lang.translateDirect("tooltip.chute.fans_" + (push > 0 ? "push_up" : "pull_down"))
.withStyle(ChatFormatting.GRAY))); .withStyle(ChatFormatting.GRAY)));
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append("-> ") .append("-> ")
.append(Lang.translate("tooltip.chute.items_move_" + (downward ? "down" : "up")) .append(Lang.translateDirect("tooltip.chute.items_move_" + (downward ? "down" : "up"))
.withStyle(ChatFormatting.YELLOW))); .withStyle(ChatFormatting.YELLOW)));
if (!item.isEmpty()) { if (!item.isEmpty()) {
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.chute.contains", new TranslatableComponent(item.getItem() .append(Lang.translateDirect("tooltip.chute.contains", new TranslatableComponent(item.getItem()
.getDescriptionId(item)).getString(), item.getCount())) .getDescriptionId(item)).getString(), item.getCount()))
.withStyle(ChatFormatting.GREEN)); .withStyle(ChatFormatting.GREEN));
} }

View file

@ -59,7 +59,7 @@ public class EjectorTargetHandler {
String key = "weighted_ejector.target_set"; String key = "weighted_ejector.target_set";
ChatFormatting colour = ChatFormatting.GOLD; ChatFormatting colour = ChatFormatting.GOLD;
player.displayClientMessage(Lang.translate(key) player.displayClientMessage(Lang.translateDirect(key)
.withStyle(colour), true); .withStyle(colour), true);
currentSelection = pos; currentSelection = pos;
launcher = null; launcher = null;
@ -101,7 +101,7 @@ public class EjectorTargetHandler {
Direction validTargetDirection = getValidTargetDirection(pos); Direction validTargetDirection = getValidTargetDirection(pos);
if (validTargetDirection == null) { if (validTargetDirection == null) {
player.displayClientMessage(Lang.translate(key) player.displayClientMessage(Lang.translateDirect(key)
.withStyle(colour), true); .withStyle(colour), true);
currentItem = null; currentItem = null;
currentSelection = null; currentSelection = null;
@ -112,7 +112,7 @@ public class EjectorTargetHandler {
colour = ChatFormatting.GREEN; colour = ChatFormatting.GREEN;
player.displayClientMessage( player.displayClientMessage(
Lang.translate(key, currentSelection.getX(), currentSelection.getY(), currentSelection.getZ()) Lang.translateDirect(key, currentSelection.getX(), currentSelection.getY(), currentSelection.getZ())
.withStyle(colour), .withStyle(colour),
true); true);

View file

@ -102,7 +102,7 @@ public class EjectorTileEntity extends KineticTileEntity {
super.addBehaviours(behaviours); super.addBehaviours(behaviours);
behaviours.add(depotBehaviour = new DepotBehaviour(this)); behaviours.add(depotBehaviour = new DepotBehaviour(this));
maxStackSize = new ScrollValueBehaviour(Lang.translate("weighted_ejector.stack_size"), this, new EjectorSlot()) maxStackSize = new ScrollValueBehaviour(Lang.translateDirect("weighted_ejector.stack_size"), this, new EjectorSlot())
.between(0, 64) .between(0, 64)
.withFormatter(i -> i == 0 ? "*" : String.valueOf(i)) .withFormatter(i -> i == 0 ? "*" : String.valueOf(i))
.onlyActiveWhen(() -> state == State.CHARGED) .onlyActiveWhen(() -> state == State.CHARGED)

View file

@ -29,7 +29,7 @@ public abstract class BrassDiodeTileEntity extends SmartTileEntity {
@Override @Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
maxState = new ScrollValueBehaviour(Lang.translate("generic.delay"), this, new BrassDiodeScrollSlot()) maxState = new ScrollValueBehaviour(Lang.translateDirect("generic.delay"), this, new BrassDiodeScrollSlot())
.between(2, 60 * 20 * 30); .between(2, 60 * 20 * 30);
maxState.withStepFunction(this::step); maxState.withStepFunction(this::step);
maxState.withFormatter(this::format); maxState.withFormatter(this::format);
@ -98,10 +98,10 @@ public abstract class BrassDiodeTileEntity extends SmartTileEntity {
private Component getUnit(int value) { private Component getUnit(int value) {
if (value < 20) if (value < 20)
return Lang.translate("generic.unit.ticks"); return Lang.translateDirect("generic.unit.ticks");
if (value < 20 * 60) if (value < 20 * 60)
return Lang.translate("generic.unit.seconds"); return Lang.translateDirect("generic.unit.seconds");
return Lang.translate("generic.unit.minutes"); return Lang.translateDirect("generic.unit.minutes");
} }
} }

View file

@ -151,7 +151,7 @@ public class DisplayLinkBlock extends WrenchableDirectionalBlock implements ITE<
if (!(player instanceof LocalPlayer)) if (!(player instanceof LocalPlayer))
return; return;
if (te.targetOffset.equals(BlockPos.ZERO)) { if (te.targetOffset.equals(BlockPos.ZERO)) {
player.displayClientMessage(Lang.translate("display_link.invalid"), true); player.displayClientMessage(Lang.translateDirect("display_link.invalid"), true);
return; return;
} }
ScreenOpener.open(new DisplayLinkScreen(te)); ScreenOpener.open(new DisplayLinkScreen(te));

View file

@ -60,7 +60,7 @@ public class DisplayLinkBlockItem extends BlockItem {
if (player.isSteppingCarefully() && stack.hasTag()) { if (player.isSteppingCarefully() && stack.hasTag()) {
if (level.isClientSide) if (level.isClientSide)
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
player.displayClientMessage(Lang.translate("display_link.clear"), true); player.displayClientMessage(Lang.translateDirect("display_link.clear"), true);
stack.setTag(null); stack.setTag(null);
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
@ -70,7 +70,7 @@ public class DisplayLinkBlockItem extends BlockItem {
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
CompoundTag stackTag = stack.getOrCreateTag(); CompoundTag stackTag = stack.getOrCreateTag();
stackTag.put("SelectedPos", NbtUtils.writeBlockPos(pos)); stackTag.put("SelectedPos", NbtUtils.writeBlockPos(pos));
player.displayClientMessage(Lang.translate("display_link.set"), true); player.displayClientMessage(Lang.translateDirect("display_link.set"), true);
stack.setTag(stackTag); stack.setTag(stackTag);
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
@ -83,7 +83,7 @@ public class DisplayLinkBlockItem extends BlockItem {
.isReplaceable() ? 0 : 1); .isReplaceable() ? 0 : 1);
if (!selectedPos.closerThan(placedPos, AllConfigs.SERVER.logistics.displayLinkRange.get())) { if (!selectedPos.closerThan(placedPos, AllConfigs.SERVER.logistics.displayLinkRange.get())) {
player.displayClientMessage(Lang.translate("display_link.too_far") player.displayClientMessage(Lang.translateDirect("display_link.too_far")
.withStyle(ChatFormatting.RED), true); .withStyle(ChatFormatting.RED), true);
return InteractionResult.FAIL; return InteractionResult.FAIL;
} }
@ -98,7 +98,7 @@ public class DisplayLinkBlockItem extends BlockItem {
ItemStack itemInHand = player.getItemInHand(pContext.getHand()); ItemStack itemInHand = player.getItemInHand(pContext.getHand());
if (!itemInHand.isEmpty()) if (!itemInHand.isEmpty())
itemInHand.setTag(null); itemInHand.setTag(null);
player.displayClientMessage(Lang.translate("display_link.success") player.displayClientMessage(Lang.translateDirect("display_link.success")
.withStyle(ChatFormatting.GREEN), true); .withStyle(ChatFormatting.GREEN), true);
return useOn; return useOn;
} }

View file

@ -140,7 +140,7 @@ public class DisplayLinkScreen extends AbstractSimiScreen {
if (rows > 1) { if (rows > 1) {
targetLineSelector = new ScrollInput(x + 61, y + 105, 135, 16).withRange(0, rows) targetLineSelector = new ScrollInput(x + 61, y + 105, 135, 16).withRange(0, rows)
.titled(Lang.translate("display_link.display_on")) .titled(Lang.translateDirect("display_link.display_on"))
.inverted() .inverted()
.calling(i -> targetLineLabel.text = target.getLineOptionText(i)) .calling(i -> targetLineLabel.text = target.getLineOptionText(i))
.setState(startIndex); .setState(startIndex);
@ -157,11 +157,11 @@ public class DisplayLinkScreen extends AbstractSimiScreen {
}); });
sourceWidget.getToolTip().addAll(List.of( sourceWidget.getToolTip().addAll(List.of(
Lang.translate("display_link.reading_from"), Lang.translateDirect("display_link.reading_from"),
sourceState.getBlock().getName() sourceState.getBlock().getName()
.withStyle(s -> s.withColor(sources.isEmpty() ? 0xF68989 : 0xF2C16D)), .withStyle(s -> s.withColor(sources.isEmpty() ? 0xF68989 : 0xF2C16D)),
Lang.translate("display_link.attached_side"), Lang.translateDirect("display_link.attached_side"),
Lang.translate("display_link.view_compatible") Lang.translateDirect("display_link.view_compatible")
.withStyle(ChatFormatting.GRAY) .withStyle(ChatFormatting.GRAY)
)); ));
@ -174,11 +174,11 @@ public class DisplayLinkScreen extends AbstractSimiScreen {
}); });
targetWidget.getToolTip().addAll(List.of( targetWidget.getToolTip().addAll(List.of(
Lang.translate("display_link.writing_to"), Lang.translateDirect("display_link.writing_to"),
targetState.getBlock().getName() targetState.getBlock().getName()
.withStyle(s -> s.withColor(target == null ? 0xF68989 : 0xF2C16D)), .withStyle(s -> s.withColor(target == null ? 0xF68989 : 0xF2C16D)),
Lang.translate("display_link.targeted_location"), Lang.translateDirect("display_link.targeted_location"),
Lang.translate("display_link.view_compatible") Lang.translateDirect("display_link.view_compatible")
.withStyle(ChatFormatting.GRAY) .withStyle(ChatFormatting.GRAY)
)); ));
@ -197,7 +197,7 @@ public class DisplayLinkScreen extends AbstractSimiScreen {
.toList(); .toList();
sourceTypeSelector = new SelectionScrollInput(x + 61, y + 26, 135, 16).forOptions(options) sourceTypeSelector = new SelectionScrollInput(x + 61, y + 26, 135, 16).forOptions(options)
.writingTo(sourceTypeLabel) .writingTo(sourceTypeLabel)
.titled(Lang.translate("display_link.information_type")) .titled(Lang.translateDirect("display_link.information_type"))
.calling(this::initGathererSourceSubOptions) .calling(this::initGathererSourceSubOptions)
.setState(startIndex); .setState(startIndex);
sourceTypeSelector.onChanged(); sourceTypeSelector.onChanged();
@ -216,8 +216,8 @@ public class DisplayLinkScreen extends AbstractSimiScreen {
if (targetLineSelector != null) if (targetLineSelector != null)
targetLineSelector targetLineSelector
.titled(source instanceof SingleLineDisplaySource ? Lang.translate("display_link.display_on") .titled(source instanceof SingleLineDisplaySource ? Lang.translateDirect("display_link.display_on")
: Lang.translate("display_link.display_on_multiline")); : Lang.translateDirect("display_link.display_on_multiline"));
configWidgets.forEach(s -> { configWidgets.forEach(s -> {
s.forEach(this::removeWidget); s.forEach(this::removeWidget);
@ -252,13 +252,13 @@ public class DisplayLinkScreen extends AbstractSimiScreen {
int y = guiTop; int y = guiTop;
background.render(ms, x, y, this); background.render(ms, x, y, this);
MutableComponent header = Lang.translate("display_link.title"); MutableComponent header = Lang.translateDirect("display_link.title");
font.draw(ms, header, x + background.width / 2 - font.width(header) / 2, y + 4, 0x442000); font.draw(ms, header, x + background.width / 2 - font.width(header) / 2, y + 4, 0x442000);
if (sources.isEmpty()) if (sources.isEmpty())
font.drawShadow(ms, Lang.translate("display_link.no_source"), x + 65, y + 30, 0xD3D3D3); font.drawShadow(ms, Lang.translateDirect("display_link.no_source"), x + 65, y + 30, 0xD3D3D3);
if (target == null) if (target == null)
font.drawShadow(ms, Lang.translate("display_link.no_target"), x + 65, y + 109, 0xD3D3D3); font.drawShadow(ms, Lang.translateDirect("display_link.no_target"), x + 65, y + 109, 0xD3D3D3);
ms.pushPose(); ms.pushPose();
ms.translate(0, guiTop + 46, 0); ms.translate(0, guiTop + 46, 0);

View file

@ -23,16 +23,16 @@ import net.minecraft.world.level.block.entity.LecternBlockEntity;
public class BoilerDisplaySource extends DisplaySource { public class BoilerDisplaySource extends DisplaySource {
public static final List<MutableComponent> notEnoughSpaceSingle = public static final List<MutableComponent> notEnoughSpaceSingle =
List.of(Lang.translate("display_source.boiler.not_enough_space") List.of(Lang.translateDirect("display_source.boiler.not_enough_space")
.append(Lang.translate("display_source.boiler.for_boiler_status"))); .append(Lang.translateDirect("display_source.boiler.for_boiler_status")));
public static final List<MutableComponent> notEnoughSpaceDouble = public static final List<MutableComponent> notEnoughSpaceDouble =
List.of(Lang.translate("display_source.boiler.not_enough_space"), List.of(Lang.translateDirect("display_source.boiler.not_enough_space"),
Lang.translate("display_source.boiler.for_boiler_status")); Lang.translateDirect("display_source.boiler.for_boiler_status"));
public static final List<List<MutableComponent>> notEnoughSpaceFlap = public static final List<List<MutableComponent>> notEnoughSpaceFlap =
List.of(List.of(Lang.translate("display_source.boiler.not_enough_space")), List.of(List.of(Lang.translateDirect("display_source.boiler.not_enough_space")),
List.of(Lang.translate("display_source.boiler.for_boiler_status"))); List.of(Lang.translateDirect("display_source.boiler.for_boiler_status")));
@Override @Override
public List<MutableComponent> provideText(DisplayLinkContext context, DisplayTargetStats stats) { public List<MutableComponent> provideText(DisplayLinkContext context, DisplayTargetStats stats) {
@ -133,7 +133,7 @@ public class BoilerDisplaySource extends DisplaySource {
heat = new TextComponent(Strings.repeat(' ', lw - labelWidthOf("heat"))).append(heat); heat = new TextComponent(Strings.repeat(' ', lw - labelWidthOf("heat"))).append(heat);
} }
return Stream.of(List.of(Lang.translate(label, boiler.getHeatLevelTextComponent())), return Stream.of(List.of(Lang.translateDirect(label, boiler.getHeatLevelTextComponent())),
List.of(size, boiler.getSizeComponent(!forFlapDisplay, forFlapDisplay, ChatFormatting.BLACK)), List.of(size, boiler.getSizeComponent(!forFlapDisplay, forFlapDisplay, ChatFormatting.BLACK)),
List.of(water, boiler.getWaterComponent(!forFlapDisplay, forFlapDisplay, ChatFormatting.BLACK)), List.of(water, boiler.getWaterComponent(!forFlapDisplay, forFlapDisplay, ChatFormatting.BLACK)),
List.of(heat, boiler.getHeatComponent(!forFlapDisplay, forFlapDisplay, ChatFormatting.BLACK))); List.of(heat, boiler.getHeatComponent(!forFlapDisplay, forFlapDisplay, ChatFormatting.BLACK)));
@ -151,7 +151,7 @@ public class BoilerDisplaySource extends DisplaySource {
private MutableComponent labelOf(String label) { private MutableComponent labelOf(String label) {
if (label.isBlank()) if (label.isBlank())
return TextComponent.EMPTY.copy(); return TextComponent.EMPTY.copy();
return Lang.translate("boiler." + label); return Lang.translateDirect("boiler." + label);
} }
@Override @Override

View file

@ -26,7 +26,7 @@ public class DeathCounterDisplaySource extends StatTrackingDisplaySource {
@Override @Override
protected Component getObjectiveDisplayName() { protected Component getObjectiveDisplayName() {
return Lang.translate("display_source.scoreboard.objective.deaths"); return Lang.translateDirect("display_source.scoreboard.objective.deaths");
} }
} }

View file

@ -38,7 +38,7 @@ public class FillLevelDisplaySource extends PercentOrProgressBarDisplaySource {
return; return;
builder.addSelectionScrollInput(0, 120, builder.addSelectionScrollInput(0, 120,
(si, l) -> si.forOptions(Lang.translatedOptions("display_source.fill_level", "percent", "progress_bar")) (si, l) -> si.forOptions(Lang.translatedOptions("display_source.fill_level", "percent", "progress_bar"))
.titled(Lang.translate("display_source.fill_level.display")), .titled(Lang.translateDirect("display_source.fill_level.display")),
"Mode"); "Mode");
} }

View file

@ -1,6 +1,5 @@
package com.simibubi.create.content.logistics.block.display.source; package com.simibubi.create.content.logistics.block.display.source;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.content.logistics.block.display.DisplayLinkBlock; import com.simibubi.create.content.logistics.block.display.DisplayLinkBlock;
import com.simibubi.create.content.logistics.block.display.DisplayLinkContext; import com.simibubi.create.content.logistics.block.display.DisplayLinkContext;
import com.simibubi.create.content.logistics.block.display.DisplayLinkTileEntity; import com.simibubi.create.content.logistics.block.display.DisplayLinkTileEntity;
@ -26,7 +25,7 @@ public class ItemThoughputDisplaySource extends AccumulatedItemCountDisplaySourc
CompoundTag conf = context.sourceConfig(); CompoundTag conf = context.sourceConfig();
if (conf.contains("Inactive")) if (conf.contains("Inactive"))
return new TextComponent("0"); return new TextComponent("0");
double interval = 20 * Math.pow(60, conf.getInt("Interval")); double interval = 20 * Math.pow(60, conf.getInt("Interval"));
double rate = conf.getFloat("Rate") * interval; double rate = conf.getFloat("Rate") * interval;
@ -45,7 +44,8 @@ public class ItemThoughputDisplaySource extends AccumulatedItemCountDisplaySourc
} }
} }
return new TextComponent(IHaveGoggleInformation.format(rate)); return Lang.number(rate)
.component();
} }
public void itemReceived(DisplayLinkTileEntity te, int amount) { public void itemReceived(DisplayLinkTileEntity te, int amount) {
@ -101,14 +101,15 @@ public class ItemThoughputDisplaySource extends AccumulatedItemCountDisplaySourc
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) { public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder,
boolean isFirstLine) {
super.initConfigurationWidgets(context, builder, isFirstLine); super.initConfigurationWidgets(context, builder, isFirstLine);
if (isFirstLine) if (isFirstLine)
return; return;
builder.addSelectionScrollInput(0, 80, (si, l) -> { builder.addSelectionScrollInput(0, 80, (si, l) -> {
si.forOptions(Lang.translatedOptions("display_source.item_throughput.interval", "second", "minute", "hour")) si.forOptions(Lang.translatedOptions("display_source.item_throughput.interval", "second", "minute", "hour"))
.titled(Lang.translate("display_source.item_throughput.interval")); .titled(Lang.translateDirect("display_source.item_throughput.interval"));
}, "Interval"); }, "Interval");
} }

View file

@ -1,6 +1,5 @@
package com.simibubi.create.content.logistics.block.display.source; package com.simibubi.create.content.logistics.block.display.source;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeTileEntity; import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeTileEntity;
import com.simibubi.create.content.logistics.block.display.DisplayLinkContext; import com.simibubi.create.content.logistics.block.display.DisplayLinkContext;
import com.simibubi.create.content.logistics.block.display.target.DisplayTargetStats; import com.simibubi.create.content.logistics.block.display.target.DisplayTargetStats;
@ -8,7 +7,6 @@ import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -16,13 +14,16 @@ public class KineticSpeedDisplaySource extends NumericSingleLineDisplaySource {
@Override @Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) { protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
if (!(context.getSourceTE() instanceof SpeedGaugeTileEntity gaugeTile)) if (!(context.getSourceTE()instanceof SpeedGaugeTileEntity gaugeTile))
return ZERO; return ZERO;
boolean absoluteValue = context.sourceConfig().getInt("Directional") == 0; boolean absoluteValue = context.sourceConfig()
.getInt("Directional") == 0;
float speed = absoluteValue ? Math.abs(gaugeTile.getSpeed()) : gaugeTile.getSpeed(); float speed = absoluteValue ? Math.abs(gaugeTile.getSpeed()) : gaugeTile.getSpeed();
return Lang.number(speed)
return new TextComponent(IHaveGoggleInformation.format(speed)); .space()
.translate("generic.unit.rpm")
.component();
} }
@Override @Override
@ -32,13 +33,15 @@ public class KineticSpeedDisplaySource extends NumericSingleLineDisplaySource {
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) { public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder,
boolean isFirstLine) {
super.initConfigurationWidgets(context, builder, isFirstLine); super.initConfigurationWidgets(context, builder, isFirstLine);
if (isFirstLine) if (isFirstLine)
return; return;
builder.addSelectionScrollInput(0, 95, (selectionScrollInput, label) -> { builder.addSelectionScrollInput(0, 95, (selectionScrollInput, label) -> {
selectionScrollInput.forOptions(Lang.translatedOptions("display_source.kinetic_speed", "absolute", "directional")); selectionScrollInput
.forOptions(Lang.translatedOptions("display_source.kinetic_speed", "absolute", "directional"));
}, "Directional"); }, "Directional");
} }

View file

@ -1,14 +1,13 @@
package com.simibubi.create.content.logistics.block.display.source; package com.simibubi.create.content.logistics.block.display.source;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeTileEntity; import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeTileEntity;
import com.simibubi.create.content.logistics.block.display.DisplayLinkContext; import com.simibubi.create.content.logistics.block.display.DisplayLinkContext;
import com.simibubi.create.content.logistics.trains.management.display.FlapDisplayTileEntity; import com.simibubi.create.content.logistics.trains.management.display.FlapDisplayTileEntity;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder; import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.LangBuilder;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -19,10 +18,11 @@ public class KineticStressDisplaySource extends PercentOrProgressBarDisplaySourc
int mode = getMode(context); int mode = getMode(context);
if (mode == 1) if (mode == 1)
return super.formatNumeric(context, currentLevel); return super.formatNumeric(context, currentLevel);
TextComponent textComponent = new TextComponent(IHaveGoggleInformation.format(currentLevel)); LangBuilder builder = Lang.number(currentLevel);
if (context.getTargetTE() instanceof FlapDisplayTileEntity) if (context.getTargetTE() instanceof FlapDisplayTileEntity)
textComponent.append(" "); builder.space();
return textComponent.append(Lang.translate("generic.unit.stress")); return builder.translate("generic.unit.stress")
.component();
} }
private int getMode(DisplayLinkContext context) { private int getMode(DisplayLinkContext context) {
@ -32,7 +32,7 @@ public class KineticStressDisplaySource extends PercentOrProgressBarDisplaySourc
@Override @Override
protected Float getProgress(DisplayLinkContext context) { protected Float getProgress(DisplayLinkContext context) {
if (!(context.getSourceTE() instanceof StressGaugeTileEntity gaugeTile)) if (!(context.getSourceTE()instanceof StressGaugeTileEntity gaugeTile))
return null; return null;
float capacity = gaugeTile.getNetworkCapacity(); float capacity = gaugeTile.getNetworkCapacity();
@ -71,7 +71,7 @@ public class KineticStressDisplaySource extends PercentOrProgressBarDisplaySourc
(si, l) -> si (si, l) -> si
.forOptions(Lang.translatedOptions("display_source.kinetic_stress", "progress_bar", "percent", .forOptions(Lang.translatedOptions("display_source.kinetic_stress", "progress_bar", "percent",
"current", "max", "remaining")) "current", "max", "remaining"))
.titled(Lang.translate("display_source.kinetic_stress.display")), .titled(Lang.translateDirect("display_source.kinetic_stress.display")),
"Mode"); "Mode");
} }

View file

@ -53,7 +53,7 @@ public class RedstonePowerDisplaySource extends PercentOrProgressBarDisplaySourc
return; return;
builder.addSelectionScrollInput(0, 120, builder.addSelectionScrollInput(0, 120,
(si, l) -> si.forOptions(Lang.translatedOptions("display_source.redstone_power", "number", "progress_bar")) (si, l) -> si.forOptions(Lang.translatedOptions("display_source.redstone_power", "number", "progress_bar"))
.titled(Lang.translate("display_source.redstone_power.display")), .titled(Lang.translateDirect("display_source.redstone_power.display")),
"Mode"); "Mode");
} }

View file

@ -47,7 +47,7 @@ public class ScoreboardDisplaySource extends ValueListDisplaySource {
private ImmutableList<IntAttached<MutableComponent>> notFound(String objective) { private ImmutableList<IntAttached<MutableComponent>> notFound(String objective) {
return ImmutableList return ImmutableList
.of(IntAttached.with(404, Lang.translate("display_source.scoreboard.objective_not_found", objective))); .of(IntAttached.with(404, Lang.translateDirect("display_source.scoreboard.objective_not_found", objective)));
} }
@Override @Override
@ -60,9 +60,9 @@ public class ScoreboardDisplaySource extends ValueListDisplaySource {
if (isFirstLine) if (isFirstLine)
builder.addTextInput(0, 137, (e, t) -> { builder.addTextInput(0, 137, (e, t) -> {
e.setValue(""); e.setValue("");
t.withTooltip(ImmutableList.of(Lang.translate("display_source.scoreboard.objective") t.withTooltip(ImmutableList.of(Lang.translateDirect("display_source.scoreboard.objective")
.withStyle(s -> s.withColor(0x5391E1)), .withStyle(s -> s.withColor(0x5391E1)),
Lang.translate("gui.schedule.lmb_edit") Lang.translateDirect("gui.schedule.lmb_edit")
.withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.ITALIC))); .withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.ITALIC)));
}, "Objective"); }, "Objective");
else else

View file

@ -34,9 +34,9 @@ public abstract class SingleLineDisplaySource extends DisplaySource {
protected void addLabelingTextBox(ModularGuiLineBuilder builder) { protected void addLabelingTextBox(ModularGuiLineBuilder builder) {
builder.addTextInput(0, 137, (e, t) -> { builder.addTextInput(0, 137, (e, t) -> {
e.setValue(""); e.setValue("");
t.withTooltip(ImmutableList.of(Lang.translate("display_source.label") t.withTooltip(ImmutableList.of(Lang.translateDirect("display_source.label")
.withStyle(s -> s.withColor(0x5391E1)), .withStyle(s -> s.withColor(0x5391E1)),
Lang.translate("gui.schedule.lmb_edit") Lang.translateDirect("gui.schedule.lmb_edit")
.withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.ITALIC))); .withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.ITALIC)));
}, "Label"); }, "Label");
} }

View file

@ -57,7 +57,7 @@ public class StationSummaryDisplaySource extends DisplaySource {
} else if (prediction.ticks < 200) { } else if (prediction.ticks < 200) {
lines.add(WHITESPACE); lines.add(WHITESPACE);
lines.add(Lang.translate("display_source.station_summary.now")); lines.add(Lang.translateDirect("display_source.station_summary.now"));
} else { } else {
int min = prediction.ticks / 1200; int min = prediction.ticks / 1200;
@ -68,8 +68,8 @@ public class StationSummaryDisplaySource extends DisplaySource {
sec = 0; sec = 0;
} }
lines.add(min > 0 ? new TextComponent(String.valueOf(min)) : WHITESPACE); lines.add(min > 0 ? new TextComponent(String.valueOf(min)) : WHITESPACE);
lines.add(min > 0 ? Lang.translate("display_source.station_summary.minutes") lines.add(min > 0 ? Lang.translateDirect("display_source.station_summary.minutes")
: Lang.translate("display_source.station_summary.seconds", sec)); : Lang.translateDirect("display_source.station_summary.seconds", sec));
} }
lines.add(prediction.train.name.copy()); lines.add(prediction.train.name.copy());
@ -187,16 +187,16 @@ public class StationSummaryDisplaySource extends DisplaySource {
if (isFirstLine) { if (isFirstLine) {
builder.addTextInput(0, 137, (e, t) -> { builder.addTextInput(0, 137, (e, t) -> {
e.setValue(""); e.setValue("");
t.withTooltip(ImmutableList.of(Lang.translate("display_source.station_summary.filter") t.withTooltip(ImmutableList.of(Lang.translateDirect("display_source.station_summary.filter")
.withStyle(s -> s.withColor(0x5391E1)), .withStyle(s -> s.withColor(0x5391E1)),
Lang.translate("gui.schedule.lmb_edit") Lang.translateDirect("gui.schedule.lmb_edit")
.withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.ITALIC))); .withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.ITALIC)));
}, "Filter"); }, "Filter");
return; return;
} }
builder.addScrollInput(0, 32, (si, l) -> { builder.addScrollInput(0, 32, (si, l) -> {
si.titled(Lang.translate("display_source.station_summary.train_name_column")) si.titled(Lang.translateDirect("display_source.station_summary.train_name_column"))
.withRange(0, 73) .withRange(0, 73)
.withShiftStep(12); .withShiftStep(12);
si.setState(50); si.setState(50);
@ -204,7 +204,7 @@ public class StationSummaryDisplaySource extends DisplaySource {
}, "NameColumn"); }, "NameColumn");
builder.addScrollInput(36, 22, (si, l) -> { builder.addScrollInput(36, 22, (si, l) -> {
si.titled(Lang.translate("display_source.station_summary.platform_column")) si.titled(Lang.translateDirect("display_source.station_summary.platform_column"))
.withRange(0, 16) .withRange(0, 16)
.withShiftStep(4); .withShiftStep(4);
si.setState(3); si.setState(3);

View file

@ -35,7 +35,7 @@ public class TimeOfDayDisplaySource extends SingleLineDisplaySource {
int dayTime = (int) (sLevel.getDayTime() % 24000); int dayTime = (int) (sLevel.getDayTime() % 24000);
int hours = (dayTime / 1000 + 6) % 24; int hours = (dayTime / 1000 + 6) % 24;
int minutes = (dayTime % 1000) * 60 / 1000; int minutes = (dayTime % 1000) * 60 / 1000;
MutableComponent suffix = Lang.translate("generic.daytime." + (hours > 11 ? "pm" : "am")); MutableComponent suffix = Lang.translateDirect("generic.daytime." + (hours > 11 ? "pm" : "am"));
minutes = minutes / 5 * 5; minutes = minutes / 5 * 5;
if (c12) { if (c12) {
@ -79,7 +79,7 @@ public class TimeOfDayDisplaySource extends SingleLineDisplaySource {
builder.addSelectionScrollInput(0, 60, (si, l) -> { builder.addSelectionScrollInput(0, 60, (si, l) -> {
si.forOptions(Lang.translatedOptions("display_source.time", "12_hour", "24_hour")) si.forOptions(Lang.translatedOptions("display_source.time", "12_hour", "24_hour"))
.titled(Lang.translate("display_source.time.format")); .titled(Lang.translateDirect("display_source.time.format"));
}, "Cycle"); }, "Cycle");
} }

View file

@ -138,11 +138,11 @@ public abstract class ValueListDisplaySource extends DisplaySource {
private Couple<MutableComponent> shorten(int number) { private Couple<MutableComponent> shorten(int number) {
if (number >= 1000000) if (number >= 1000000)
return Couple.create(new TextComponent(String.valueOf(number / 1000000)), return Couple.create(new TextComponent(String.valueOf(number / 1000000)),
Lang.translate("display_source.value_list.million") Lang.translateDirect("display_source.value_list.million")
.append(WHITESPACE)); .append(WHITESPACE));
if (number >= 1000) if (number >= 1000)
return Couple.create(new TextComponent(String.valueOf(number / 1000)), return Couple.create(new TextComponent(String.valueOf(number / 1000)),
Lang.translate("display_source.value_list.thousand") Lang.translateDirect("display_source.value_list.thousand")
.append(WHITESPACE)); .append(WHITESPACE));
return Couple.create(new TextComponent(String.valueOf(number)), WHITESPACE); return Couple.create(new TextComponent(String.valueOf(number)), WHITESPACE);
} }
@ -163,7 +163,7 @@ public abstract class ValueListDisplaySource extends DisplaySource {
protected void addFullNumberConfig(ModularGuiLineBuilder builder) { protected void addFullNumberConfig(ModularGuiLineBuilder builder) {
builder.addSelectionScrollInput(0, 75, builder.addSelectionScrollInput(0, 75,
(si, l) -> si.forOptions(Lang.translatedOptions("display_source.value_list", "shortened", "full_number")) (si, l) -> si.forOptions(Lang.translatedOptions("display_source.value_list", "shortened", "full_number"))
.titled(Lang.translate("display_source.value_list.display")), .titled(Lang.translateDirect("display_source.value_list.display")),
"Format"); "Format");
} }

View file

@ -32,7 +32,7 @@ public abstract class DisplayTarget extends DisplayBehaviour {
} }
public Component getLineOptionText(int line) { public Component getLineOptionText(int line) {
return Lang.translate("display_target.line", line + 1); return Lang.translateDirect("display_target.line", line + 1);
} }
public static void reserve(int line, BlockEntity target, DisplayLinkContext context) { public static void reserve(int line, BlockEntity target, DisplayLinkContext context) {

View file

@ -65,7 +65,7 @@ public class LecternDisplayTarget extends DisplayTarget {
} }
public Component getLineOptionText(int line) { public Component getLineOptionText(int line) {
return Lang.translate("display_target.page", line + 1); return Lang.translateDirect("display_target.page", line + 1);
} }
private ItemStack signBook(ItemStack book) { private ItemStack signBook(ItemStack book) {

View file

@ -24,7 +24,7 @@ public abstract class SingleLineDisplayTarget extends DisplayTarget {
@Override @Override
public Component getLineOptionText(int line) { public Component getLineOptionText(int line) {
return Lang.translate("display_target.single_line"); return Lang.translateDirect("display_target.single_line");
} }
protected abstract int getWidth(DisplayLinkContext context); protected abstract int getWidth(DisplayLinkContext context);

View file

@ -6,7 +6,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Str
import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@ -178,16 +177,14 @@ public class ArmInteractionPoint {
} }
public enum Mode { public enum Mode {
DEPOSIT("mechanical_arm.deposit_to", ChatFormatting.GOLD, 0xFFCB74), DEPOSIT("mechanical_arm.deposit_to", 0xDDC166),
TAKE("mechanical_arm.extract_from", ChatFormatting.AQUA, 0x4F8A8B); TAKE("mechanical_arm.extract_from", 0x7FCDE0);
private final String translationKey; private final String translationKey;
private final ChatFormatting chatColor;
private final int color; private final int color;
Mode(String translationKey, ChatFormatting chatColor, int color) { Mode(String translationKey, int color) {
this.translationKey = translationKey; this.translationKey = translationKey;
this.chatColor = chatColor;
this.color = color; this.color = color;
} }
@ -195,10 +192,6 @@ public class ArmInteractionPoint {
return translationKey; return translationKey;
} }
public ChatFormatting getChatColor() {
return chatColor;
}
public int getColor() { public int getColor() {
return color; return color;
} }

View file

@ -16,7 +16,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -64,11 +63,12 @@ public class ArmInteractionPointHandler {
selected.cycleMode(); selected.cycleMode();
if (player != null) { if (player != null) {
String key = selected.getMode().getTranslationKey(); Mode mode = selected.getMode();
ChatFormatting colour = selected.getMode().getChatColor(); Lang.builder()
MutableComponent translatedBlock = state.getBlock().getName(); .translate(mode.getTranslationKey(), Lang.blockName(state)
player.displayClientMessage((Lang.translate(key, translatedBlock.withStyle(ChatFormatting.WHITE, colour)).withStyle(colour)), .style(ChatFormatting.WHITE))
true); .color(mode.getColor())
.sendStatus(player);
} }
event.setCanceled(true); event.setCanceled(true);
@ -95,7 +95,8 @@ public class ArmInteractionPointHandler {
int removed = 0; int removed = 0;
for (Iterator<ArmInteractionPoint> iterator = currentSelection.iterator(); iterator.hasNext();) { for (Iterator<ArmInteractionPoint> iterator = currentSelection.iterator(); iterator.hasNext();) {
ArmInteractionPoint point = iterator.next(); ArmInteractionPoint point = iterator.next();
if (point.getPos().closerThan(pos, ArmTileEntity.getRange())) if (point.getPos()
.closerThan(pos, ArmTileEntity.getRange()))
continue; continue;
iterator.remove(); iterator.remove();
removed++; removed++;
@ -103,8 +104,10 @@ public class ArmInteractionPointHandler {
LocalPlayer player = Minecraft.getInstance().player; LocalPlayer player = Minecraft.getInstance().player;
if (removed > 0) { if (removed > 0) {
player.displayClientMessage(Lang.createTranslationTextComponent("mechanical_arm.points_outside_range", removed) Lang.builder()
.withStyle(ChatFormatting.RED), true); .translate("mechanical_arm.points_outside_range", removed)
.style(ChatFormatting.RED)
.sendStatus(player);
} else { } else {
int inputs = 0; int inputs = 0;
int outputs = 0; int outputs = 0;
@ -115,8 +118,10 @@ public class ArmInteractionPointHandler {
inputs++; inputs++;
} }
if (inputs + outputs > 0) if (inputs + outputs > 0)
player.displayClientMessage(Lang.createTranslationTextComponent("mechanical_arm.summary", inputs, outputs) Lang.builder()
.withStyle(ChatFormatting.WHITE), true); .translate("mechanical_arm.summary", inputs, outputs)
.style(ChatFormatting.WHITE)
.sendStatus(player);
} }
AllPackets.channel.sendToServer(new ArmPlacementPacket(currentSelection, pos)); AllPackets.channel.sendToServer(new ArmPlacementPacket(currentSelection, pos));
@ -194,11 +199,12 @@ public class ArmInteractionPointHandler {
if (shape.isEmpty()) if (shape.isEmpty())
continue; continue;
int color = point.getMode().getColor(); int color = point.getMode()
.getColor();
CreateClient.OUTLINER.showAABB(point, shape.bounds() CreateClient.OUTLINER.showAABB(point, shape.bounds()
.move(pos)) .move(pos))
.colored(color) .colored(color)
.lineWidth(1 / 16f); .lineWidth(1 / 16f);
} }
} }
@ -215,7 +221,8 @@ public class ArmInteractionPointHandler {
private static ArmInteractionPoint getSelected(BlockPos pos) { private static ArmInteractionPoint getSelected(BlockPos pos) {
for (ArmInteractionPoint point : currentSelection) for (ArmInteractionPoint point : currentSelection)
if (point.getPos().equals(pos)) if (point.getPos()
.equals(pos))
return point; return point;
return null; return null;
} }

View file

@ -102,7 +102,7 @@ public class ArmTileEntity extends KineticTileEntity implements ITransformableTE
super.addBehaviours(behaviours); super.addBehaviours(behaviours);
selectionMode = new ScrollOptionBehaviour<SelectionMode>(SelectionMode.class, selectionMode = new ScrollOptionBehaviour<SelectionMode>(SelectionMode.class,
Lang.translate("logistics.when_multiple_outputs_available"), this, new SelectionModeValueBox()); Lang.translateDirect("logistics.when_multiple_outputs_available"), this, new SelectionModeValueBox());
selectionMode.requiresWrench(); selectionMode.requiresWrench();
behaviours.add(selectionMode); behaviours.add(selectionMode);

View file

@ -79,7 +79,7 @@ public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggl
@Override @Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("tooltip.analogStrength", this.state))); tooltip.add(componentSpacing.plainCopy().append(Lang.translateDirect("tooltip.analogStrength", this.state)));
return true; return true;
} }

View file

@ -25,7 +25,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
private IconButton confirmButton; private IconButton confirmButton;
private IconButton flipSignals; private IconButton flipSignals;
private final Component invertSignal = Lang.translate("gui.stockpile_switch.invert_signal"); private final Component invertSignal = Lang.translateDirect("gui.stockpile_switch.invert_signal");
private final ItemStack renderedItem = new ItemStack(AllBlocks.STOCKPILE_SWITCH.get()); private final ItemStack renderedItem = new ItemStack(AllBlocks.STOCKPILE_SWITCH.get());
private AllGuiTextures background; private AllGuiTextures background;
@ -36,7 +36,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
private LerpedFloat cursorLane; private LerpedFloat cursorLane;
public StockpileSwitchScreen(StockpileSwitchTileEntity te) { public StockpileSwitchScreen(StockpileSwitchTileEntity te) {
super(Lang.translate("gui.stockpile_switch.title")); super(Lang.translateDirect("gui.stockpile_switch.title"));
background = AllGuiTextures.STOCKSWITCH; background = AllGuiTextures.STOCKSWITCH;
this.te = te; this.te = te;
lastModification = -1; lastModification = -1;
@ -60,7 +60,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
.titled(TextComponent.EMPTY.plainCopy()) .titled(TextComponent.EMPTY.plainCopy())
.calling(state -> { .calling(state -> {
lastModification = 0; lastModification = 0;
offBelow.titled(Lang.translate("gui.stockpile_switch.move_to_upper_at", state)); offBelow.titled(Lang.translateDirect("gui.stockpile_switch.move_to_upper_at", state));
if (onAbove.getState() <= state) { if (onAbove.getState() <= state) {
onAbove.setState(state + 1); onAbove.setState(state + 1);
onAbove.onChanged(); onAbove.onChanged();
@ -72,7 +72,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
.titled(TextComponent.EMPTY.plainCopy()) .titled(TextComponent.EMPTY.plainCopy())
.calling(state -> { .calling(state -> {
lastModification = 0; lastModification = 0;
onAbove.titled(Lang.translate("gui.stockpile_switch.move_to_lower_at", state)); onAbove.titled(Lang.translateDirect("gui.stockpile_switch.move_to_lower_at", state));
if (offBelow.getState() >= state) { if (offBelow.getState() >= state) {
offBelow.setState(state - 1); offBelow.setState(state - 1);
offBelow.onChanged(); offBelow.onChanged();

View file

@ -59,7 +59,7 @@ public class LinkedControllerClientHandler {
if (MODE == Mode.IDLE) { if (MODE == Mode.IDLE) {
MODE = Mode.ACTIVE; MODE = Mode.ACTIVE;
lecternPos = null; lecternPos = null;
} else { } else {
MODE = Mode.IDLE; MODE = Mode.IDLE;
onReset(); onReset();
} }
@ -84,7 +84,8 @@ public class LinkedControllerClientHandler {
} }
protected static void onReset() { protected static void onReset() {
ControlsUtil.getControls().forEach(kb -> kb.setDown(ControlsUtil.isActuallyPressed(kb))); ControlsUtil.getControls()
.forEach(kb -> kb.setDown(ControlsUtil.isActuallyPressed(kb)));
packetCooldown = 0; packetCooldown = 0;
selectedLocation = BlockPos.ZERO; selectedLocation = BlockPos.ZERO;
@ -126,7 +127,8 @@ public class LinkedControllerClientHandler {
} }
} }
if (inLectern() && AllBlocks.LECTERN_CONTROLLER.get().getTileEntityOptional(mc.level, lecternPos) if (inLectern() && AllBlocks.LECTERN_CONTROLLER.get()
.getTileEntityOptional(mc.level, lecternPos)
.map(te -> !te.isUsedBy(mc.player)) .map(te -> !te.isUsedBy(mc.player))
.orElse(true)) { .orElse(true)) {
deactivateInLectern(); deactivateInLectern();
@ -139,7 +141,8 @@ public class LinkedControllerClientHandler {
return; return;
} }
if (InputConstants.isKeyDown(mc.getWindow().getWindow(), GLFW.GLFW_KEY_ESCAPE)) { if (InputConstants.isKeyDown(mc.getWindow()
.getWindow(), GLFW.GLFW_KEY_ESCAPE)) {
MODE = Mode.IDLE; MODE = Mode.IDLE;
onReset(); onReset();
return; return;
@ -206,13 +209,15 @@ public class LinkedControllerClientHandler {
controls.forEach(kb -> kb.setDown(false)); controls.forEach(kb -> kb.setDown(false));
} }
public static void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width1, int height1) { public static void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width1,
int height1) {
if (MODE != Mode.BIND) if (MODE != Mode.BIND)
return; return;
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
poseStack.pushPose(); poseStack.pushPose();
Screen tooltipScreen = new Screen(TextComponent.EMPTY) {}; Screen tooltipScreen = new Screen(TextComponent.EMPTY) {
};
tooltipScreen.init(mc, width1, height1); tooltipScreen.init(mc, width1, height1);
Object[] keys = new Object[6]; Object[] keys = new Object[6];
@ -224,11 +229,10 @@ public class LinkedControllerClientHandler {
} }
List<Component> list = new ArrayList<>(); List<Component> list = new ArrayList<>();
list.add(Lang.createTranslationTextComponent("linked_controller.bind_mode") list.add(Lang.translateDirect("linked_controller.bind_mode")
.withStyle(ChatFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
list.addAll( list.addAll(TooltipHelper.cutTextComponent(Lang.translateDirect("linked_controller.press_keybind", keys),
TooltipHelper.cutTextComponent(Lang.createTranslationTextComponent("linked_controller.press_keybind", keys), ChatFormatting.GRAY, ChatFormatting.GRAY));
ChatFormatting.GRAY, ChatFormatting.GRAY));
int width = 0; int width = 0;
int height = list.size() * mc.font.lineHeight; int height = list.size() * mc.font.lineHeight;

View file

@ -57,9 +57,7 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
addRenderableWidget(resetButton); addRenderableWidget(resetButton);
addRenderableWidget(confirmButton); addRenderableWidget(confirmButton);
extraAreas = ImmutableList.of( extraAreas = ImmutableList.of(new Rect2i(x + background.width + 4, y + background.height - 44, 64, 56));
new Rect2i(x + background.width + 4, y + background.height - 44, 64, 56)
);
} }
@Override @Override
@ -74,8 +72,8 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
background.render(ms, x, y, this); background.render(ms, x, y, this);
font.draw(ms, title, x + 15, y + 4, 0x442000); font.draw(ms, title, x + 15, y + 4, 0x442000);
GuiGameElement.of(menu.contentHolder) GuiGameElement.of(menu.contentHolder).<GuiGameElement
.<GuiGameElement.GuiRenderBuilder>at(x + background.width - 4, y + background.height - 56, -200) .GuiRenderBuilder>at(x + background.width - 4, y + background.height - 56, -200)
.scale(5) .scale(5)
.render(ms); .render(ms);
} }
@ -111,12 +109,10 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
private List<Component> addToTooltip(List<Component> list, int slot) { private List<Component> addToTooltip(List<Component> list, int slot) {
if (slot < 0 || slot >= 12) if (slot < 0 || slot >= 12)
return list; return list;
list.add(Lang list.add(Lang.translateDirect("linked_controller.frequency_slot_" + ((slot % 2) + 1), ControlsUtil.getControls()
.createTranslationTextComponent("linked_controller.frequency_slot_" + ((slot % 2) + 1), .get(slot / 2)
ControlsUtil.getControls() .getTranslatedKeyMessage()
.get(slot / 2) .getString())
.getTranslatedKeyMessage()
.getString())
.withStyle(ChatFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
return list; return list;
} }

View file

@ -30,19 +30,19 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
private static final String PREFIX = "gui.attribute_filter."; private static final String PREFIX = "gui.attribute_filter.";
private Component addDESC = Lang.translate(PREFIX + "add_attribute"); private Component addDESC = Lang.translateDirect(PREFIX + "add_attribute");
private Component addInvertedDESC = Lang.translate(PREFIX + "add_inverted_attribute"); private Component addInvertedDESC = Lang.translateDirect(PREFIX + "add_inverted_attribute");
private Component allowDisN = Lang.translate(PREFIX + "allow_list_disjunctive"); private Component allowDisN = Lang.translateDirect(PREFIX + "allow_list_disjunctive");
private Component allowDisDESC = Lang.translate(PREFIX + "allow_list_disjunctive.description"); private Component allowDisDESC = Lang.translateDirect(PREFIX + "allow_list_disjunctive.description");
private Component allowConN = Lang.translate(PREFIX + "allow_list_conjunctive"); private Component allowConN = Lang.translateDirect(PREFIX + "allow_list_conjunctive");
private Component allowConDESC = Lang.translate(PREFIX + "allow_list_conjunctive.description"); private Component allowConDESC = Lang.translateDirect(PREFIX + "allow_list_conjunctive.description");
private Component denyN = Lang.translate(PREFIX + "deny_list"); private Component denyN = Lang.translateDirect(PREFIX + "deny_list");
private Component denyDESC = Lang.translate(PREFIX + "deny_list.description"); private Component denyDESC = Lang.translateDirect(PREFIX + "deny_list.description");
private Component referenceH = Lang.translate(PREFIX + "add_reference_item"); private Component referenceH = Lang.translateDirect(PREFIX + "add_reference_item");
private Component noSelectedT = Lang.translate(PREFIX + "no_selected_attributes"); private Component noSelectedT = Lang.translateDirect(PREFIX + "no_selected_attributes");
private Component selectedT = Lang.translate(PREFIX + "selected_attributes"); private Component selectedT = Lang.translateDirect(PREFIX + "selected_attributes");
private IconButton whitelistDis, whitelistCon, blacklist; private IconButton whitelistDis, whitelistCon, blacklist;
private Indicator whitelistDisIndicator, whitelistConIndicator, blacklistIndicator; private Indicator whitelistDisIndicator, whitelistConIndicator, blacklistIndicator;

View file

@ -89,7 +89,7 @@ public class FilterItem extends Item implements MenuProvider {
boolean blacklist = filter.getOrCreateTag() boolean blacklist = filter.getOrCreateTag()
.getBoolean("Blacklist"); .getBoolean("Blacklist");
list.add((blacklist ? Lang.translate("gui.filter.deny_list") : Lang.translate("gui.filter.allow_list")).withStyle(ChatFormatting.GOLD)); list.add((blacklist ? Lang.translateDirect("gui.filter.deny_list") : Lang.translateDirect("gui.filter.allow_list")).withStyle(ChatFormatting.GOLD));
int count = 0; int count = 0;
for (int i = 0; i < filterItems.getSlots(); i++) { for (int i = 0; i < filterItems.getSlots(); i++) {
if (count > 3) { if (count > 3) {
@ -112,10 +112,10 @@ public class FilterItem extends Item implements MenuProvider {
WhitelistMode whitelistMode = WhitelistMode.values()[filter.getOrCreateTag() WhitelistMode whitelistMode = WhitelistMode.values()[filter.getOrCreateTag()
.getInt("WhitelistMode")]; .getInt("WhitelistMode")];
list.add((whitelistMode == WhitelistMode.WHITELIST_CONJ list.add((whitelistMode == WhitelistMode.WHITELIST_CONJ
? Lang.translate("gui.attribute_filter.allow_list_conjunctive") ? Lang.translateDirect("gui.attribute_filter.allow_list_conjunctive")
: whitelistMode == WhitelistMode.WHITELIST_DISJ : whitelistMode == WhitelistMode.WHITELIST_DISJ
? Lang.translate("gui.attribute_filter.allow_list_disjunctive") ? Lang.translateDirect("gui.attribute_filter.allow_list_disjunctive")
: Lang.translate("gui.attribute_filter.deny_list")).withStyle(ChatFormatting.GOLD)); : Lang.translateDirect("gui.attribute_filter.deny_list")).withStyle(ChatFormatting.GOLD));
int count = 0; int count = 0;
ListTag attributes = filter.getOrCreateTag() ListTag attributes = filter.getOrCreateTag()

View file

@ -19,15 +19,15 @@ public class FilterScreen extends AbstractFilterScreen<FilterContainer> {
private static final String PREFIX = "gui.filter."; private static final String PREFIX = "gui.filter.";
private Component allowN = Lang.translate(PREFIX + "allow_list"); private Component allowN = Lang.translateDirect(PREFIX + "allow_list");
private Component allowDESC = Lang.translate(PREFIX + "allow_list.description"); private Component allowDESC = Lang.translateDirect(PREFIX + "allow_list.description");
private Component denyN = Lang.translate(PREFIX + "deny_list"); private Component denyN = Lang.translateDirect(PREFIX + "deny_list");
private Component denyDESC = Lang.translate(PREFIX + "deny_list.description"); private Component denyDESC = Lang.translateDirect(PREFIX + "deny_list.description");
private Component respectDataN = Lang.translate(PREFIX + "respect_data"); private Component respectDataN = Lang.translateDirect(PREFIX + "respect_data");
private Component respectDataDESC = Lang.translate(PREFIX + "respect_data.description"); private Component respectDataDESC = Lang.translateDirect(PREFIX + "respect_data.description");
private Component ignoreDataN = Lang.translate(PREFIX + "ignore_data"); private Component ignoreDataN = Lang.translateDirect(PREFIX + "ignore_data");
private Component ignoreDataDESC = Lang.translate(PREFIX + "ignore_data.description"); private Component ignoreDataDESC = Lang.translateDirect(PREFIX + "ignore_data.description");
private IconButton whitelist, blacklist; private IconButton whitelist, blacklist;
private IconButton respectNBT, ignoreNBT; private IconButton respectNBT, ignoreNBT;

View file

@ -122,7 +122,7 @@ public interface ItemAttribute {
@OnlyIn(value = Dist.CLIENT) @OnlyIn(value = Dist.CLIENT)
default TranslatableComponent format(boolean inverted) { default TranslatableComponent format(boolean inverted) {
return Lang.translate("item_attributes." + getTranslationKey() + (inverted ? ".inverted" : ""), return Lang.translateDirect("item_attributes." + getTranslationKey() + (inverted ? ".inverted" : ""),
getTranslationParameters()); getTranslationParameters());
} }
@ -300,7 +300,7 @@ public interface ItemAttribute {
@Override @Override
@OnlyIn(value = Dist.CLIENT) @OnlyIn(value = Dist.CLIENT)
public TranslatableComponent format(boolean inverted) { public TranslatableComponent format(boolean inverted) {
return Lang.translate("item_attributes." + getTranslationKey() + (inverted ? ".inverted" : ""), return Lang.translateDirect("item_attributes." + getTranslationKey() + (inverted ? ".inverted" : ""),
group.getDisplayName()); group.getDisplayName());
} }

View file

@ -48,7 +48,7 @@ public class ShulkerFillLevelAttribute implements ItemAttribute {
public Object[] getTranslationParameters() { public Object[] getTranslationParameters() {
String parameter = ""; String parameter = "";
if (levels != null) if (levels != null)
parameter = Lang.translate("item_attributes." + getTranslationKey() + "." + levels.key).getString(); parameter = Lang.translateDirect("item_attributes." + getTranslationKey() + "." + levels.key).getString();
return new Object[]{parameter}; return new Object[]{parameter};
} }

View file

@ -99,9 +99,9 @@ public class CarriageContraption extends Contraption {
if (bogeys == 0) if (bogeys == 0)
return false; return false;
if (bogeys > 2) if (bogeys > 2)
throw new AssemblyException(Lang.translate("train_assembly.too_many_bogeys", bogeys)); throw new AssemblyException(Lang.translateDirect("train_assembly.too_many_bogeys", bogeys));
if (sidewaysControls) if (sidewaysControls)
throw new AssemblyException(Lang.translate("train_assembly.sideways_controls")); throw new AssemblyException(Lang.translateDirect("train_assembly.sideways_controls"));
for (BlockPos blazePos : assembledBlazeBurners) for (BlockPos blazePos : assembledBlazeBurners)
for (Direction direction : Iterate.directionsInAxis(assemblyDirection.getAxis())) for (Direction direction : Iterate.directionsInAxis(assemblyDirection.getAxis()))

View file

@ -528,7 +528,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
@Override @Override
public Component getDisplayName() { public Component getDisplayName() {
if (carriage == null) if (carriage == null)
return Lang.translate("train"); return Lang.translateDirect("train");
return carriage.train.name; return carriage.train.name;
} }
@ -587,7 +587,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
boolean spaceDown = heldControls.contains(4); boolean spaceDown = heldControls.contains(4);
GlobalStation currentStation = carriage.train.getCurrentStation(); GlobalStation currentStation = carriage.train.getCurrentStation();
if (currentStation != null && spaceDown) { if (currentStation != null && spaceDown) {
sendPrompt(player, Lang.translate("train.arrived_at", sendPrompt(player, Lang.translateDirect("train.arrived_at",
new TextComponent(currentStation.name).withStyle(s -> s.withColor(0x704630))), false); new TextComponent(currentStation.name).withStyle(s -> s.withColor(0x704630))), false);
return true; return true;
} }
@ -599,7 +599,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
if (currentStation != null && targetSpeed != 0) { if (currentStation != null && targetSpeed != 0) {
stationMessage = false; stationMessage = false;
sendPrompt(player, Lang.translate("train.departing_from", sendPrompt(player, Lang.translateDirect("train.departing_from",
new TextComponent(currentStation.name).withStyle(s -> s.withColor(0x704630))), false); new TextComponent(currentStation.name).withStyle(s -> s.withColor(0x704630))), false);
} }
@ -680,7 +680,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
private void displayApproachStationMessage(Player player, GlobalStation station) { private void displayApproachStationMessage(Player player, GlobalStation station) {
sendPrompt(player, sendPrompt(player,
Lang.translate("contraption.controls.approach_station", new KeybindComponent("key.jump"), station.name), Lang.translateDirect("contraption.controls.approach_station", new KeybindComponent("key.jump"), station.name),
false); false);
stationMessage = true; stationMessage = true;
} }

View file

@ -140,7 +140,7 @@ public class Train {
this.carriageSpacing = carriageSpacing; this.carriageSpacing = carriageSpacing;
this.icon = TrainIconType.getDefault(); this.icon = TrainIconType.getDefault();
this.stress = new double[carriageSpacing.size()]; this.stress = new double[carriageSpacing.size()];
this.name = Lang.translate("train.unnamed"); this.name = Lang.translateDirect("train.unnamed");
this.status = new TrainStatus(this); this.status = new TrainStatus(this);
this.doubleEnded = doubleEnded; this.doubleEnded = doubleEnded;

View file

@ -96,7 +96,7 @@ public class TrainRelocationPacket extends SimplePacketBase {
} }
if (TrainRelocator.relocate(train, sender.level, pos, hoveredBezier, direction, lookAngle, false)) { if (TrainRelocator.relocate(train, sender.level, pos, hoveredBezier, direction, lookAngle, false)) {
sender.displayClientMessage(Lang.translate("train.relocate.success") sender.displayClientMessage(Lang.translateDirect("train.relocate.success")
.withStyle(ChatFormatting.GREEN), true); .withStyle(ChatFormatting.GREEN), true);
train.carriages.forEach(c -> c.forEachPresentEntity(e -> { train.carriages.forEach(c -> c.forEachPresentEntity(e -> {
e.nonDamageTicks = 10; e.nonDamageTicks = 10;

View file

@ -83,7 +83,7 @@ public class TrainRelocator {
if (!player.position() if (!player.position()
.closerThan(relocatingOrigin, 24) || player.isSteppingCarefully()) { .closerThan(relocatingOrigin, 24) || player.isSteppingCarefully()) {
relocatingTrain = null; relocatingTrain = null;
player.displayClientMessage(Lang.translate("train.relocate.abort") player.displayClientMessage(Lang.translateDirect("train.relocate.abort")
.withStyle(ChatFormatting.RED), true); .withStyle(ChatFormatting.RED), true);
return; return;
} }
@ -294,14 +294,14 @@ public class TrainRelocator {
if (entity instanceof AbstractContraptionEntity ce && Math.abs(ce.getPosition(0) if (entity instanceof AbstractContraptionEntity ce && Math.abs(ce.getPosition(0)
.subtract(ce.getPosition(1)) .subtract(ce.getPosition(1))
.lengthSqr()) > 1 / 1024d) { .lengthSqr()) > 1 / 1024d) {
player.displayClientMessage(Lang.translate("train.cannot_relocate_moving") player.displayClientMessage(Lang.translateDirect("train.cannot_relocate_moving")
.withStyle(ChatFormatting.RED), true); .withStyle(ChatFormatting.RED), true);
relocatingTrain = null; relocatingTrain = null;
return; return;
} }
if (!AllItems.WRENCH.isIn(player.getMainHandItem())) { if (!AllItems.WRENCH.isIn(player.getMainHandItem())) {
player.displayClientMessage(Lang.translate("train.relocate.abort") player.displayClientMessage(Lang.translateDirect("train.relocate.abort")
.withStyle(ChatFormatting.RED), true); .withStyle(ChatFormatting.RED), true);
relocatingTrain = null; relocatingTrain = null;
return; return;
@ -309,19 +309,19 @@ public class TrainRelocator {
if (!player.position() if (!player.position()
.closerThan(relocatingOrigin, 24)) { .closerThan(relocatingOrigin, 24)) {
player.displayClientMessage(Lang.translate("train.relocate.too_far") player.displayClientMessage(Lang.translateDirect("train.relocate.too_far")
.withStyle(ChatFormatting.RED), true); .withStyle(ChatFormatting.RED), true);
return; return;
} }
Boolean success = relocateClient(relocating, true); Boolean success = relocateClient(relocating, true);
if (success == null) if (success == null)
player.displayClientMessage(Lang.translate("train.relocate", relocating.name), true); player.displayClientMessage(Lang.translateDirect("train.relocate", relocating.name), true);
else if (success.booleanValue()) else if (success.booleanValue())
player.displayClientMessage(Lang.translate("train.relocate.valid") player.displayClientMessage(Lang.translateDirect("train.relocate.valid")
.withStyle(ChatFormatting.GREEN), true); .withStyle(ChatFormatting.GREEN), true);
else else
player.displayClientMessage(Lang.translate("train.relocate.invalid") player.displayClientMessage(Lang.translateDirect("train.relocate.invalid")
.withStyle(ChatFormatting.RED), true); .withStyle(ChatFormatting.RED), true);
return; return;
} }

Some files were not shown because too many files have changed in this diff Show more