diff --git a/src/main/java/binnie/extratrees/block/decor/BlockMultiFence.java b/src/main/java/binnie/extratrees/block/decor/BlockMultiFence.java index f7179b7c..59742c19 100644 --- a/src/main/java/binnie/extratrees/block/decor/BlockMultiFence.java +++ b/src/main/java/binnie/extratrees/block/decor/BlockMultiFence.java @@ -19,9 +19,13 @@ import forestry.api.core.IModelManager; import forestry.api.core.IStateMapperRegister; import forestry.api.core.Tabs; import forestry.arboriculture.PluginArboriculture; +import forestry.arboriculture.WoodAccess; +import forestry.arboriculture.items.ItemBlockWood; +import forestry.arboriculture.items.ItemBlockWoodDoor; import forestry.core.blocks.properties.UnlistedBlockAccess; import forestry.core.blocks.properties.UnlistedBlockPos; import forestry.core.models.BlockModelEntry; +import forestry.core.utils.Translator; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.BlockFenceGate; @@ -191,13 +195,18 @@ public class BlockMultiFence extends BlockFence implements IBlockMetadata, IStat @Override - public String getDisplayName(final ItemStack par1ItemStack) { - final int meta = TileEntityMetadata.getItemDamage(par1ItemStack); - final IPlankType type1 = this.getDescription(meta).getPlankType(); - final IPlankType type2 = this.getDescription(meta).getSecondaryPlankType(); - final boolean twoTypes = type1 != type2; - final FenceType type3 = this.getDescription(meta).getFenceType(); - return Binnie.LANGUAGE.localise(ExtraTrees.instance, "block.woodslab.name" + (twoTypes ? "2" : ""), type3.getPrefix(), type1.getName(), type2.getName()); + public String getDisplayName(ItemStack itemStack) { + int meta = TileEntityMetadata.getItemDamage(itemStack); + IPlankType typeFirst = this.getDescription(meta).getPlankType(); + IPlankType typeSecond = this.getDescription(meta).getSecondaryPlankType(); + boolean twoTypes = typeFirst != typeSecond; + FenceType fenceType = this.getDescription(meta).getFenceType(); + String woodGrammar = ExtraTrees.proxy.localise("block.multifence" + (twoTypes ? "2" : "") + ".grammar"); + + woodGrammar = woodGrammar.replaceAll("%PREFIX", fenceType.getPrefix()); + woodGrammar = woodGrammar.replaceAll("%TYPE", typeSecond.getName()); + woodGrammar = woodGrammar.replaceAll("%WOOD", typeFirst.getName()); + return woodGrammar; } @SideOnly(Side.CLIENT) diff --git a/src/main/java/binnie/extratrees/block/decor/FenceType.java b/src/main/java/binnie/extratrees/block/decor/FenceType.java index e3e6e2a8..9d2cf8c6 100644 --- a/src/main/java/binnie/extratrees/block/decor/FenceType.java +++ b/src/main/java/binnie/extratrees/block/decor/FenceType.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import binnie.extratrees.ExtraTrees; + public class FenceType { public static List VALUES; @@ -18,7 +20,28 @@ public class FenceType { } public String getPrefix() { - return ((this.size == 0) ? "" : ((this.size == 1) ? "Full " : "Low ")) + (this.solid ? "Solid " : "") + (this.embossed ? "Embedded " : ""); + String prefix = ""; + if(size == 1){ + prefix+=ExtraTrees.proxy.localise("multifence.low.type"); + }else if(size == 2){ + prefix+=ExtraTrees.proxy.localise("multifence.full.type"); + } + if(solid){ + if(!prefix.isEmpty()){ + prefix+=" "; + } + prefix+=ExtraTrees.proxy.localise("multifence.solid.type"); + } + if(embossed){ + if(!prefix.isEmpty()){ + prefix+=" "; + } + prefix+=ExtraTrees.proxy.localise("multifence.embedded.type"); + } + if(!prefix.isEmpty()){ + prefix+=" "; + } + return prefix; } public int ordinal() { @@ -33,6 +56,7 @@ public class FenceType { public static Collection values() { if(VALUES == null){ + VALUES = new ArrayList<>(); for (int size = 0; size < 3; ++size) { for (final boolean solid : new boolean[]{false, true}) { for (final boolean embedded : new boolean[]{false, true}) { diff --git a/src/main/resources/assets/extratrees/lang/en_US.lang b/src/main/resources/assets/extratrees/lang/en_US.lang index 75b7bda2..4dd1abc2 100644 --- a/src/main/resources/assets/extratrees/lang/en_US.lang +++ b/src/main/resources/assets/extratrees/lang/en_US.lang @@ -221,22 +221,18 @@ extratrees.block.door.type.solid=Solid extratrees.block.door.type.double=Split extratrees.block.door.type.full=Full -< %1$s is name of the wood> -extratrees.block.plank.name=%1$s Wood Planks -extratrees.block.log.name=%1$s Wood -extratrees.block.woodslab.name=%1$s Wood Slab -extratrees.block.woodstairs.name=%1$s Stairs -extratrees.block.woodfence.name=%1$s Fence -extratrees.block.woodgate.name=%1$s Gate - extrabees.poison.name=Poison extrabees.acid.name=Acid extrabees.glacial.name=Glacial -< %1$s is the adjective for the fence type, %2$s is the name of the wood > -extratrees.block.multifence.name=%2$s %1$s Gate -< %3$s is the name of the second wood > -extratrees.block.multifence.name2=%2$s %1$s & $2$s Gate +< %PREFIX is the adjective for the fence type, %WOOD is the name of the wood > +extratrees.block.multifence.grammar=%PREFIX%WOOD Fence +< %TYPE is the name of the second wood > +extratrees.block.multifence2.grammar=%PREFIX%WOOD & %TYPE Fence +extratrees.multifence.low.type=Low +extratrees.multifence.full.type=Full +extratrees.multifence.solid.type=Solid +extratrees.multifence.embedded.type=Embedded < %1$s is name of the design > extratrees.block.woodentile.name=%1$s Wooden Tile