From 504835246c0c4c423ebb915026ff1ecaae78738c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 20 Nov 2016 13:46:35 +0100 Subject: [PATCH] Named all containers. Closes #383 --- .../mod/tile/TileEntityBase.java | 8 ++++++- .../mod/tile/TileEntityInventoryBase.java | 2 +- .../actuallyadditions/mod/util/AssetUtil.java | 5 ++-- .../assets/actuallyadditions/lang/en_US.lang | 23 +++++++++++++++++++ 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 80eab409d..6437e93ef 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient; import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.compat.TeslaUtil; import net.minecraft.block.state.IBlockState; @@ -27,6 +28,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; @@ -204,9 +206,13 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ return !oldState.getBlock().isAssociatedBlock(newState.getBlock()); } + public String getDisplayedName(){ + return StringUtil.localize("container."+ModUtil.MOD_ID+"."+this.name+".name"); + } + @Override public ITextComponent getDisplayName(){ - return new TextComponentTranslation("container."+ModUtil.MOD_ID+"."+this.name+".name"); + return new TextComponentString(this.getDisplayedName()); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java index 10cfea1f3..a026d215e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java @@ -197,7 +197,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements @Override public String getName(){ - return this.name; + return this.getDisplayedName(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index 606a51ebf..76deaa85e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.util; import de.ellpeck.actuallyadditions.mod.misc.ParticleColored; import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -54,8 +55,8 @@ public final class AssetUtil{ } @SideOnly(Side.CLIENT) - public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, TileEntity tile){ - displayNameString(font, xSize, yPositionOfMachineText, tile.getDisplayName().getFormattedText()); + public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, TileEntityBase tile){ + displayNameString(font, xSize, yPositionOfMachineText, tile.getDisplayedName()); } @SideOnly(Side.CLIENT) diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 445dd5fa4..a9b3f440d 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -645,6 +645,29 @@ container.actuallyadditions.bag.name=Traveler's Sack container.actuallyadditions.voidBag.name=Void Sack container.actuallyadditions.bioReactor.name=Bio Reactor container.actuallyadditions.farmer.name=Farmer +container.actuallyadditions.compost.name=Compost +container.actuallyadditions.fishingNet.name=Fishing Net +container.actuallyadditions.solarPanel.name=Solar Panel +container.actuallyadditions.heatCollector.name=Heat Collector +container.actuallyadditions.greenhouseGlass.name=Greenhouse Glass +container.actuallyadditions.playerInterface.name=Player Interface +container.actuallyadditions.lavaFactory.name=Lava Factory Controller +container.actuallyadditions.phantomBooster.name=Phantom Booster +container.actuallyadditions.smileyCloud.name=Smiley Cloud +container.actuallyadditions.leafGenerator.name=Not a Munchdew +container.actuallyadditions.reconstructor.name=Atomic Reconstructor +container.actuallyadditions.redstoneface.name=Phantom Redstoneface +container.actuallyadditions.laserRelayItem.name=Item Laser Relay +container.actuallyadditions.laserRelay.name=Laser Relay +container.actuallyadditions.laserRelayAdvanced.name=Advanced Laser Relay +container.actuallyadditions.laserRelayExtreme.name=Extreme Laser Relay +container.actuallyadditions.itemViewer.name=Item Interface +container.actuallyadditions.displayStand.name=Display Stand +container.actuallyadditions.shockSuppressor.name=Shock Suppressor +container.actuallyadditions.empowerer.name=Empowerer +container.actuallyadditions.laserRelayFluids.name=Fluid Laser Relay +container.actuallyadditions.distributorItem.name=Item Distributor +container.actuallyadditions.fireworkBox.name=Firework Box #Update Information info.actuallyadditions.update.generic=[{"text":"There is an Update for "},{"text":"Actually Additions ","color":"dark_green"},{"text":"available!","color":"none"}]