Use translation keys on RebornCore and CellItem. Thanks to Maz-T
This commit is contained in:
parent
b378f2dcb9
commit
4ce4d6c361
2 changed files with 4 additions and 2 deletions
|
@ -41,6 +41,7 @@ import net.minecraft.fluid.Fluid;
|
|||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -183,6 +184,6 @@ public class FluidUtils {
|
|||
}
|
||||
|
||||
public static String getFluidName(@NotNull Fluid fluid) {
|
||||
return StringUtils.capitalize(Registry.FLUID.getId(fluid).getPath());
|
||||
return new TranslatableText(fluid.getDefaultState().getBlockState().getBlock().getTranslationKey()).getString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ import net.minecraft.sound.SoundEvents;
|
|||
import net.minecraft.tag.FluidTags;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
|
@ -166,7 +167,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
|
|||
Fluid fluid = getFluid(itemStack);
|
||||
if (fluid != Fluids.EMPTY) {
|
||||
// TODO use translation keys for fluid and the cell https://fabric.asie.pl/wiki/tutorial:lang?s[]=translation might be useful
|
||||
return new LiteralText(WordUtils.capitalizeFully(FluidUtils.getFluidName(fluid).replaceAll("_", " ")) + " Cell");
|
||||
return new LiteralText(new TranslatableText("item.techreborn.cell.fluid").getString().replace("$fluid$", FluidUtils.getFluidName(fluid)));
|
||||
}
|
||||
return super.getName(itemStack);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue