Fix MultiFence Name

This commit is contained in:
Nedelosk committed 2017-04-10 20:49:10 +02:00
1 parent bb9427367d
commit 3124c00152
3 files changed
+49 -20

No files matched your search

@@ -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)
@@ -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<FenceType> 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<FenceType> 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}) {