mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-19 03:49:07 +00:00
Improve ceramic localization
This commit is contained in:
1 parent
e0d23ada41
commit
6df4570bca
10 files changed
+128
-119
No files matched your search
@@ -5,6 +5,7 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.carpentry.BlockDesign;
|
||||
import binnie.extratrees.carpentry.DesignBlock;
|
||||
@@ -26,6 +27,6 @@ public class BlockCeramicPatterned extends BlockDesign {
|
||||
|
||||
@Override
|
||||
public String getBlockName(final DesignBlock design) {
|
||||
return design.getDesign().getName() + " Ceramic Block";
|
||||
return I18N.localise("botany.ceramic.block.name", design.getDesign().getName());
|
||||
}
|
||||
}
|
||||
@@ -137,14 +137,14 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored
|
||||
|
||||
@Override
|
||||
public String getDisplayName(final ItemStack itemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return EnumFlowerColor.get(meta).getFlowerColorAllele().getColorName() + " " + I18N.localise("tile.botany.pigmented.glass.name");
|
||||
EnumFlowerColor color = EnumFlowerColor.get(TileEntityMetadata.getItemDamage(itemStack));
|
||||
return I18N.localise("botany.pigmented.glass.name", color.getDisplayName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item itemIn, final CreativeTabs tab, final NonNullList<ItemStack> itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, color.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +178,7 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored
|
||||
if (worldIn == null || pos == null) {
|
||||
return 0;
|
||||
}
|
||||
return EnumFlowerColor.get(TileEntityMetadata.getTileMetadata(worldIn, pos)).getFlowerColorAllele().getColor(false);
|
||||
EnumFlowerColor color = EnumFlowerColor.get(TileEntityMetadata.getTileMetadata(worldIn, pos));
|
||||
return color.getFlowerColorAllele().getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package binnie.botany.ceramic;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -10,6 +9,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.core.items.IColoredItem;
|
||||
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ItemCeramic extends ItemBlock implements IColoredItem {
|
||||
public ItemCeramic(BlockCeramic block) {
|
||||
@@ -24,12 +24,14 @@ public class ItemCeramic extends ItemBlock implements IColoredItem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
return EnumFlowerColor.get(stack.getMetadata()).getFlowerColorAllele().getColor(false);
|
||||
EnumFlowerColor color = EnumFlowerColor.get(stack.getItemDamage());
|
||||
return color.getFlowerColorAllele().getColor(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getItemStackDisplayName(ItemStack itemStack) {
|
||||
return EnumFlowerColor.get(itemStack.getItemDamage()).getFlowerColorAllele().getColorName() + " " + I18n.translateToLocal("tile.botany.ceramic.name").trim();
|
||||
EnumFlowerColor color = EnumFlowerColor.get(itemStack.getItemDamage());
|
||||
return I18N.localise("botany.ceramic.name", color.getDisplayName());
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ public class ItemStainedGlass extends ItemMetadata implements IColoredItem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
return EnumFlowerColor.get(TileEntityMetadata.getItemDamage(stack)).getFlowerColorAllele().getColor(false);
|
||||
EnumFlowerColor color = EnumFlowerColor.get(TileEntityMetadata.getItemDamage(stack));
|
||||
return color.getFlowerColorAllele().getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class CeramicBrickPair {
|
||||
EnumFlowerColor colorFirst;
|
||||
@@ -48,7 +49,7 @@ public class CeramicBrickPair {
|
||||
if (this.type.canDouble() && this.colorSecond != this.colorFirst) {
|
||||
name = name + " & " + this.colorSecond.getFlowerColorAllele().getColorName();
|
||||
}
|
||||
return name + " " + this.type.name;
|
||||
return I18N.localise("botany.ceramic.type." + type.id + ".name", name);
|
||||
}
|
||||
|
||||
public int ordinal() {
|
||||
|
||||
@@ -18,7 +18,7 @@ import binnie.botany.items.BotanyItems;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
|
||||
public enum CeramicBrickType implements IStringSerializable {
|
||||
Tile("tile", "Ceramic Tile") {
|
||||
Tile("tile") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
@@ -52,19 +52,19 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
return new CeramicBrickPair(c, c, CeramicBrickType.Tile).getStack(3);
|
||||
}
|
||||
},
|
||||
Brick("brick", "Ceramic Bricks") {
|
||||
Brick("brick") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getBrickRecipe(this, stacks);
|
||||
}
|
||||
},
|
||||
StripeBrick("brickstripe", "Striped Ceramic Bricks") {
|
||||
StripeBrick("brickstripe") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getBrickRecipe(this, stacks);
|
||||
}
|
||||
},
|
||||
LargeBrick("bricklarge", "Large Ceramic Bricks") {
|
||||
LargeBrick("bricklarge") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() == 1) {
|
||||
@@ -113,7 +113,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
}
|
||||
},
|
||||
Split("split", "Split Ceramic Tile") {
|
||||
Split("split") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
@@ -141,7 +141,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.Split).getStack(4);
|
||||
}
|
||||
},
|
||||
Chequered("cheque", "Chequered Ceramic Tile") {
|
||||
Chequered("cheque") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
@@ -170,7 +170,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.Chequered).getStack(4);
|
||||
}
|
||||
},
|
||||
Mixed("mixed", "Mixed Ceramic Tile") {
|
||||
Mixed("mixed") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
@@ -209,19 +209,19 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.Mixed).getStack(4);
|
||||
}
|
||||
},
|
||||
VerticalBrick("verticalbrick", "Vertical Ceramic Bricks") {
|
||||
VerticalBrick("verticalbrick") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getVerticalBrickRecipe(stacks);
|
||||
}
|
||||
},
|
||||
VerticalStripeBrick("verticalbrickstripe", "Vertical Striped Ceramic Bricks") {
|
||||
VerticalStripeBrick("verticalbrickstripe") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getVerticalBrickRecipe(stacks);
|
||||
}
|
||||
},
|
||||
VerticalLargeBrick("verticalbricklarge", "Large Vertical Ceramic Bricks") {
|
||||
VerticalLargeBrick("verticalbricklarge") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getVerticalBrickRecipe(stacks);
|
||||
@@ -231,15 +231,13 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
public static final CeramicBrickType[] VALUES = values();
|
||||
|
||||
String id;
|
||||
String name;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nullable
|
||||
TextureAtlasSprite[] sprites;
|
||||
|
||||
CeramicBrickType(final String id, final String name) {
|
||||
CeramicBrickType(String id) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static CeramicBrickType get(final int id) {
|
||||
|
||||
@@ -27,15 +27,6 @@ public class TileCeramicBrick extends TileEntity {
|
||||
return s;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
CeramicBrickType type = CeramicBrickType.VALUES[getBlockMetadata()];
|
||||
String name = this.colorFirst.getFlowerColorAllele().getColorName();
|
||||
if (type.canDouble() && this.colorSecond != this.colorFirst) {
|
||||
name = name + " & " + this.colorSecond.getFlowerColorAllele().getColorName();
|
||||
}
|
||||
return name + " " + type.name;
|
||||
}
|
||||
|
||||
public int ordinal() {
|
||||
return this.colorFirst.ordinal() + this.colorSecond.ordinal() * 256 + getBlockMetadata() * 256 * 256;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.util.IStringSerializable;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public enum EnumFlowerColor implements IStringSerializable {
|
||||
Aquamarine("aquamarine", 8388564),
|
||||
@@ -2940,6 +2941,10 @@ public enum EnumFlowerColor implements IStringSerializable {
|
||||
return values()[Math.max(0, i) % values().length];
|
||||
}
|
||||
|
||||
public String getDisplayName(){
|
||||
return I18N.localise("botany.color." + getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase();
|
||||
|
||||
@@ -5,9 +5,6 @@ import forestry.api.genetics.IAlleleInteger;
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
/**
|
||||
* Created by Marcin on 03.06.2017.
|
||||
*/
|
||||
public class FlowerColorAllele implements IFlowerColour, IAlleleInteger {
|
||||
private int color;
|
||||
private String uid;
|
||||
|
||||
Reference in new issue
Block a user