Skip to content

Commit

Permalink
applied I18Wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Uhutown committed Sep 28, 2023
1 parent 748dd0a commit 37f2129
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 186 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/troblecodings/signals/SEProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import java.util.function.Predicate;

import com.google.common.collect.ImmutableList;
import com.troblecodings.core.I18Wrapper;
import com.troblecodings.core.NBTWrapper;
import com.troblecodings.guilib.ecs.interfaces.IIntegerable;
import com.troblecodings.signals.core.JsonEnum;
import com.troblecodings.signals.enums.ChangeableStage;

import net.minecraft.client.resources.language.I18n;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.data.IModelData;
Expand Down Expand Up @@ -141,7 +141,8 @@ public SEAutoNameProp(final String name, final JsonEnum parent, final String def
@OnlyIn(Dist.CLIENT)
@Override
public String getNamedObj(final int obj) {
return I18n.get("property." + this.getName() + ".name") + ": " + getObjFromID(obj);
return I18Wrapper.format("property." + this.getName() + ".name") + ": "
+ getObjFromID(obj);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.function.Consumer;
import java.util.stream.Collectors;

import com.troblecodings.core.I18Wrapper;
import com.troblecodings.core.ReadBuffer;
import com.troblecodings.core.WriteBuffer;
import com.troblecodings.guilib.ecs.ContainerBase;
Expand All @@ -29,7 +30,6 @@
import com.troblecodings.signals.signalbox.entrys.PathEntryType;
import com.troblecodings.signals.signalbox.entrys.PathOptionEntry;

import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.Rotation;
Expand Down Expand Up @@ -119,11 +119,11 @@ public void deserializeClient(final ReadBuffer buffer) {
break;
}
case NO_PW_FOUND: {
infoUpdates.accept(I18n.get("error.nopathfound"));
infoUpdates.accept(I18Wrapper.format("error.nopathfound"));
break;
}
case NO_OUTPUT_UPDATE: {
infoUpdates.accept(I18n.get("error.nooutputupdate"));
infoUpdates.accept(I18Wrapper.format("error.nooutputupdate"));
break;
}
case OUTPUT_UPDATE: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.function.IntConsumer;

import com.mojang.blaze3d.vertex.PoseStack;
import com.troblecodings.core.I18Wrapper;
import com.troblecodings.core.NBTWrapper;
import com.troblecodings.core.WriteBuffer;
import com.troblecodings.guilib.ecs.GuiBase;
Expand All @@ -24,7 +25,6 @@
import com.troblecodings.signals.enums.ChangeableStage;
import com.troblecodings.signals.items.Placementtool;

import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
Expand Down Expand Up @@ -101,7 +101,7 @@ private void initInternal() {
lowerEntity.setInheritHeight(true);
lowerEntity.setInheritWidth(true);

final UILabel titlelabel = new UILabel(I18n.get("property.signal.name"));
final UILabel titlelabel = new UILabel(I18Wrapper.format("property.signal.name"));
titlelabel.setCenterX(false);

final UIEntity titel = new UIEntity();
Expand Down Expand Up @@ -150,7 +150,7 @@ public void updateFromContainer() {
textfield.setInheritWidth(true);
if (currentSelectedBlock.canHaveCustomname(new HashMap<>())) {
final UITextInput name = new UITextInput(container.signalName);
textfield.add(new UIToolTip(I18n.get("property.customname.desc")));
textfield.add(new UIToolTip(I18Wrapper.format("property.customname.desc")));
name.setOnTextUpdate(this::sendName);
textfield.add(name);
list.add(textfield);
Expand Down
179 changes: 97 additions & 82 deletions src/main/java/com/troblecodings/signals/guis/GuiSignalBox.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import java.util.List;
import java.util.Map;

import com.troblecodings.core.I18Wrapper;
import com.troblecodings.core.WriteBuffer;
import com.troblecodings.guilib.ecs.DrawUtil.DisableIntegerable;
import com.troblecodings.guilib.ecs.DrawUtil.EnumIntegerable;
import com.troblecodings.guilib.ecs.DrawUtil.SizeIntegerables;
import com.troblecodings.core.WriteBuffer;
import com.troblecodings.guilib.ecs.GuiBase;
import com.troblecodings.guilib.ecs.GuiElements;
import com.troblecodings.guilib.ecs.GuiInfo;
Expand Down Expand Up @@ -37,7 +38,6 @@

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.player.Player;
Expand Down Expand Up @@ -228,7 +228,7 @@ private void addRSInputMode() {
SizeIntegerables.of("profile", 32, in -> String.valueOf(in)));
lowerEntity.add(GuiElements.createEnumElement(profile, e -> sendRSInputProfileToServer(e),
controller.linkedRSInputProfile));
lowerEntity.add(GuiElements.createButton(I18n.get("gui.unlink"), e -> {
lowerEntity.add(GuiElements.createButton(I18Wrapper.format("gui.unlink"), e -> {
unlinkInputPos();
label.setText("Linked To: not linked");
}));
Expand All @@ -244,7 +244,7 @@ private void initInternal() {
}
lowerEntity.setInherits(true);

final String name = I18n.get("tile." + signal.delegate.name().getPath() + ".name")
final String name = I18Wrapper.format("tile." + signal.delegate.name().getPath() + ".name")
+ "; Name: "
+ ClientNameHandler.getClientName(new NameStateInfo(mc.level, controller.getPos()));

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/troblecodings/signals/guis/NamableGui.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.troblecodings.signals.guis;

import com.troblecodings.core.I18Wrapper;
import com.troblecodings.core.WriteBuffer;
import com.troblecodings.guilib.ecs.GuiBase;
import com.troblecodings.guilib.ecs.GuiElements;
Expand All @@ -15,7 +16,6 @@
import com.troblecodings.signals.init.OSBlocks;
import com.troblecodings.signals.tileentitys.RedstoneIOTileEntity;

import net.minecraft.client.resources.language.I18n;
import net.minecraft.world.entity.player.Player;

public class NamableGui extends GuiBase {
Expand Down Expand Up @@ -62,10 +62,10 @@ private void initOwn() {

final UITextInput input = new UITextInput(container.tile.getNameWrapper());
textfield.add(input);
textfield.add(new UIToolTip(I18n.get("property.customname.desc")));
textfield.add(new UIToolTip(I18Wrapper.format("property.customname.desc")));

hbox.add(textfield);
final UIEntity apply = GuiElements.createButton(I18n.get("btn.apply"),
final UIEntity apply = GuiElements.createButton(I18Wrapper.format("btn.apply"),
_u -> this.updateText(input.getText()));
apply.setInheritWidth(false);
apply.setWidth(60);
Expand All @@ -74,7 +74,7 @@ private void initOwn() {
if (!(container.tile instanceof RedstoneIOTileEntity)) {
return;
}
inner.add(GuiElements.createLabel(I18n.get("label.linkedto")));
inner.add(GuiElements.createLabel(I18Wrapper.format("label.linkedto")));
final UIEntity list = new UIEntity();
list.setInheritHeight(true);
list.setInheritWidth(true);
Expand Down
Loading

0 comments on commit 37f2129

Please sign in to comment.