From 751746df6f3fc428a54b90a7ebe43ab76ba4b8d4 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Thu, 28 Dec 2017 14:19:26 +0000 Subject: [PATCH] Allow lang files to specify the location of the fluid name, closes #1386 --- src/main/java/techreborn/items/DynamicCell.java | 10 ++++------ src/main/resources/assets/techreborn/lang/en_us.lang | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/techreborn/items/DynamicCell.java b/src/main/java/techreborn/items/DynamicCell.java index 24f09aacc..f2dde863e 100644 --- a/src/main/java/techreborn/items/DynamicCell.java +++ b/src/main/java/techreborn/items/DynamicCell.java @@ -40,13 +40,10 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.translation.I18n; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidUtil; -import net.minecraftforge.fluids.IFluidBlock; +import net.minecraftforge.fluids.*; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; import org.apache.commons.lang3.Validate; @@ -161,12 +158,13 @@ public class DynamicCell extends Item { } } + @SuppressWarnings("deprecation") @Override public String getItemStackDisplayName(ItemStack stack) { FluidStack fluidStack = getFluidHandler(stack).getFluid(); if (fluidStack == null) return super.getItemStackDisplayName(stack); - return fluidStack.getLocalizedName() + " Cell"; + return I18n.translateToLocal("item.techreborn.cell.fluid.name").replaceAll("\\$fluid\\$", fluidStack.getLocalizedName()); } @Override diff --git a/src/main/resources/assets/techreborn/lang/en_us.lang b/src/main/resources/assets/techreborn/lang/en_us.lang index e5187da17..00704c203 100644 --- a/src/main/resources/assets/techreborn/lang/en_us.lang +++ b/src/main/resources/assets/techreborn/lang/en_us.lang @@ -375,6 +375,7 @@ item.techreborn.dustsmall.diorite.name=Small Pile of Diorite Dust item.techreborn.dustsmall.granite.name=Small Pile of Granite Dust item.techreborn.cell.name=Empty Cell +item.techreborn.cell.fluid.name=$fluid$ Cell item.techreborn.rebattery.name=Battery item.techreborn.lithiumBattery.name=Lithium Battery item.techreborn.energyCrystal.name=Energy Crystal