Skip to content

Commit

Permalink
Fix Localization Issues on Dedicated Servers
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Jan 4, 2025
1 parent d41d49e commit 49dde87
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import com.nomiceu.nomilabs.util.LabsTranslate;

import gregtech.api.metatileentity.SimpleMachineMetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
Expand Down Expand Up @@ -56,7 +55,8 @@ private String useUnlocalizedName3(Fluid instance, FluidStack stack) {

@ModifyConstant(method = "addProbeInfo", constant = @Constant(stringValue = "Tank"))
private String localizedTank(String constant) {
return LabsTranslate.translate("topaddons.fluid_display.tank.display.default");
String langKey = "topaddons.fluid_display.tank.display.default";
return langKey;
}

@Inject(method = "addProbeInfo",
Expand Down Expand Up @@ -94,9 +94,9 @@ private void gtTankNames(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer play

if (tile instanceof IGregTechTileEntity gt && gt.getMetaTileEntity() instanceof SimpleMachineMetaTileEntity) {
if (i > inputAmt.get() - 1)
tankName.set(LabsTranslate.translate("topaddons.fluid_display.tank.display.output"));
tankName.set("topaddons.fluid_display.tank.display.output");
else
tankName.set(LabsTranslate.translate("topaddons.fluid_display.tank.display.input"));
tankName.set("topaddons.fluid_display.tank.display.input");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import com.nomiceu.nomilabs.integration.top.LabsFluidNameElement;
import com.nomiceu.nomilabs.util.LabsTranslate;

import gregtech.api.util.TextFormattingUtil;
import io.github.drmanganese.topaddons.elements.ElementTankGauge;
Expand Down Expand Up @@ -92,7 +93,7 @@ private void newRenderLogic(int x, int y, CallbackInfo ci) {
ElementTextRender.render(labs$getCapacityInfo(), x + 3, y + 2);
ElementTextRender.render(labs$getTankFluidTitle(), x + 1, y + 14);
} else {
drawSmallText(x + 2, y + 2, tankName, 0xffffffff);
drawSmallText(x + 2, y + 2, labs$getTranslatedTankName(), 0xffffffff);
}

ci.cancel();
Expand All @@ -117,11 +118,16 @@ private void newHeightLogic(CallbackInfoReturnable<Integer> cir) {
private String labs$getTankFluidTitle() {
if (labs$tankFluidTitle != null) return labs$tankFluidTitle;

labs$tankFluidTitle = tankName + ": " +
labs$tankFluidTitle = labs$getTranslatedTankName() + ": " +
LabsFluidNameElement.translateFluid(fluidName, amount, "ElementTankGauge");
return labs$tankFluidTitle;
}

@Unique
private String labs$getTranslatedTankName() {
return LabsTranslate.translate(tankName);
}

@Unique
private String labs$getCapacityInfo() {
if (labs$capacityInfo != null) return labs$capacityInfo;
Expand Down

0 comments on commit 49dde87

Please sign in to comment.