Improve insulated tube and color localization

This commit is contained in:
Nedelosk committed 2017-06-27 16:33:41 +02:00
1 parent 9989eef753
commit b7b663640d
25 files changed
+133 -106

No files matched your search

@@ -9,5 +9,5 @@ public interface IFlowerColour {
int getID();
String getColourName();
String getColorName();
}
@@ -138,7 +138,7 @@ 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().getColourName() + " " + I18N.localise("tile.botany.pigmented.glass.name");
return EnumFlowerColor.get(meta).getFlowerColorAllele().getColorName() + " " + I18N.localise("tile.botany.pigmented.glass.name");
}
@Override
@@ -30,6 +30,6 @@ public class ItemCeramic extends ItemBlock implements IColoredItem {
@Override
@SideOnly(Side.CLIENT)
public String getItemStackDisplayName(ItemStack itemStack) {
return EnumFlowerColor.get(itemStack.getItemDamage()).getFlowerColorAllele().getColourName() + " " + I18n.translateToLocal("tile.botany.ceramic.name").trim();
return EnumFlowerColor.get(itemStack.getItemDamage()).getFlowerColorAllele().getColorName() + " " + I18n.translateToLocal("tile.botany.ceramic.name").trim();
}
}
@@ -44,9 +44,9 @@ public class CeramicBrickPair {
}
public String getName() {
String name = this.colorFirst.getFlowerColorAllele().getColourName();
String name = this.colorFirst.getFlowerColorAllele().getColorName();
if (this.type.canDouble() && this.colorSecond != this.colorFirst) {
name = name + " & " + this.colorSecond.getFlowerColorAllele().getColourName();
name = name + " & " + this.colorSecond.getFlowerColorAllele().getColorName();
}
return name + " " + this.type.name;
}
@@ -29,9 +29,9 @@ public class TileCeramicBrick extends TileEntity {
public String getName() {
CeramicBrickType type = CeramicBrickType.VALUES[getBlockMetadata()];
String name = this.colorFirst.getFlowerColorAllele().getColourName();
String name = this.colorFirst.getFlowerColorAllele().getColorName();
if (type.canDouble() && this.colorSecond != this.colorFirst) {
name = name + " & " + this.colorSecond.getFlowerColorAllele().getColourName();
name = name + " & " + this.colorSecond.getFlowerColorAllele().getColorName();
}
return name + " " + type.name;
}
@@ -41,6 +41,6 @@ public class ControlColorDisplay extends Control implements IControlValue<IFlowe
@Override
public void getTooltip(final Tooltip tooltip) {
super.getTooltip(tooltip);
tooltip.add(this.value.getColourName());
tooltip.add(this.value.getColorName());
}
}
@@ -17,7 +17,7 @@ public class ControlColorOption extends ControlTextOption<IFlowerColour> {
Point boxPosition;
public ControlColorOption(final ControlList<IFlowerColour> controlList, final IFlowerColour option, final int y) {
super(controlList, option, option.getColourName(), y);
super(controlList, option, option.getColorName(), y);
this.setSize(new Point(this.getSize().x(), 20));
this.controlBee = new ControlColorDisplay(this, 2, 2, option);
this.addAttribute(Attribute.MouseOver);
@@ -3,14 +3,18 @@ package binnie.botany.flower;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
enum EnumTubeInsulate {
Clay(0xa1aacc, "Clay"),
Cobble(0x7b7b7b, "Cobblestone"),
Sand(0xefeab5, "Sand"),
HardenedClay(0x935c43, "Hardened Clay"),
Stone(0x6d6d6d, "Smooth Stone"),
Sandstone(0xc1b989, "Sandstone");
import binnie.core.util.I18N;
enum EnumTubeInsulate {
Clay(0xa1aacc, "clay"),
Cobble(0x7b7b7b, "cobblestone"),
Sand(0xefeab5, "sand"),
HardenedClay(0x935c43, "hardened_clay"),
Stone(0x6d6d6d, "stone"),
Sandstone(0xc1b989, "sandstone");
public static final EnumTubeInsulate[] VALUES = values();
int color;
String name;
@@ -19,16 +23,16 @@ enum EnumTubeInsulate {
this.name = name;
}
public static EnumTubeInsulate get(final int i) {
return values()[i / 128 % values().length];
public static EnumTubeInsulate get(int meta) {
return VALUES[meta / 128 % VALUES.length];
}
public int getColor() {
return this.color;
}
public String getName() {
return this.name;
public String getDisplayName() {
return I18N.localise("botany.tube.insulate." + name + ".name");
}
public ItemStack getStack() {
@@ -1,11 +1,15 @@
package binnie.botany.flower;
enum EnumTubeMaterial {
Copper(0xe3b78e, "Copper"),
Tin(0xe1eef4, "Tin"),
Bronze(0xddc276, "Bronze"),
Iron(0xd8d8d8, "Iron");
import binnie.core.util.I18N;
enum EnumTubeMaterial {
Copper(0xe3b78e, "copper"),
Tin(0xe1eef4, "tin"),
Bronze(0xddc276, "bronze"),
Iron(0xd8d8d8, "iron");
public static final EnumTubeMaterial[] VALUES = values();
int color;
String name;
@@ -14,15 +18,15 @@ enum EnumTubeMaterial {
this.name = name;
}
public static EnumTubeMaterial get(final int i) {
return values()[i % values().length];
public static EnumTubeMaterial get(int meta) {
return VALUES[meta % VALUES.length];
}
public int getColor() {
return this.color;
}
public String getName() {
return this.name;
public String getDisplayName() {
return I18N.localise("botany.tube.material." + name + ".name");
}
}
@@ -90,24 +90,21 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister
@Override
@SideOnly(Side.CLIENT)
public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List<String> list, final boolean flag) {
if (!itemStack.hasTagCompound()) {
return;
}
IFlower individual = (IFlower) this.getIndividual(itemStack);
if (individual == null) {
list.add(TextFormatting.DARK_RED + I18N.localise("botany.flower.destroy"));
list.add(TextFormatting.DARK_RED + I18N.localise("item.botany.flower.destroy"));
return;
}
IFlowerGenome genome = individual.getGenome();
//Colors
String primaryColor = genome.getPrimaryColor().getColourName();
String secondaryColor = genome.getSecondaryColor().getColourName();
String stemColor = genome.getStemColor().getColourName();
String primaryColor = genome.getPrimaryColor().getColorName();
String secondaryColor = genome.getSecondaryColor().getColorName();
String stemColor = genome.getStemColor().getColorName();
String colorInfo;
if (!primaryColor.equals(secondaryColor)) {
colorInfo = I18N.localise("botany.grammar.flower.secondary");
colorInfo = I18N.localise("item.botany.grammar.flower.secondary");
} else {
colorInfo = I18N.localise("botany.grammar.flower");
colorInfo = I18N.localise("item.botany.grammar.flower");
}
list.add(TextFormatting.YELLOW + colorInfo.replaceAll("%PRIMARY", primaryColor).replaceAll("%SECONDARY", secondaryColor).replaceAll("%STEM", stemColor));
@@ -27,11 +27,12 @@ import forestry.core.utils.Translator;
import binnie.botany.CreativeTabBotany;
import binnie.core.item.ItemCore;
import binnie.core.util.I18N;
public class ItemInsulatedTube extends ItemCore implements IColoredItem {
public ItemInsulatedTube() {
super("insulated_tube");
setUnlocalizedName("insulated_tube");
setUnlocalizedName("botany.insulated_tube");
setCreativeTab(CreativeTabBotany.instance);
setHasSubtypes(true);
}
@@ -49,7 +50,7 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem {
}
public static String getInsulate(ItemStack stack) {
return EnumTubeInsulate.get(stack.getItemDamage()).getName();
return EnumTubeInsulate.get(stack.getItemDamage()).getDisplayName();
}
public static ItemStack getInsulateStack(ItemStack stack) {
@@ -111,6 +112,6 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem {
@Override
public String getItemStackDisplayName(ItemStack itemStack) {
int meta = itemStack.getMetadata();
return EnumTubeMaterial.get(meta).getName() + " " + EnumTubeInsulate.get(meta).getName() + " " + super.getItemStackDisplayName(itemStack);
return I18N.localise("item.botany.insulated_tube.name", EnumTubeMaterial.get(meta).getDisplayName(), EnumTubeInsulate.get(meta).getDisplayName());
}
}
@@ -39,23 +39,23 @@ import binnie.botany.core.BotanyCore;
public class ItemTrowel extends Item implements IItemModelRegister {
protected final ToolMaterial theToolMaterial;
protected final String locName;
protected final String modelName;
public ItemTrowel(ToolMaterial p_i45343_1_, final String material) {
this.theToolMaterial = p_i45343_1_;
this.maxStackSize = 1;
this.setMaxDamage(p_i45343_1_.getMaxUses());
public ItemTrowel(ToolMaterial toolMaterial, String materialName) {
this.theToolMaterial = toolMaterial;
this.setMaxStackSize(1);
this.setMaxDamage(toolMaterial.getMaxUses());
this.setCreativeTab(CreativeTabBotany.instance);
this.setUnlocalizedName("trowel_" + material);
this.locName = "trowel_" + material;
setRegistryName("trowel_" + material);
this.modelName = "trowel_" + materialName;
this.setUnlocalizedName("botany." + modelName);
this.setRegistryName(modelName);
}
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
manager.registerItemModel(item, new ItemTrowelMeshDefinition());
ModelBakery.registerItemVariants(item, new ResourceLocation(Constants.BOTANY_MOD_ID + ":tools/" + locName));
ModelBakery.registerItemVariants(item, new ResourceLocation(Constants.BOTANY_MOD_ID + ":tools/" + modelName));
}
@Override
@@ -106,7 +106,7 @@ public class ItemTrowel extends Item implements IItemModelRegister {
private class ItemTrowelMeshDefinition implements ItemMeshDefinition {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":tools/" + locName, "inventory");
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":tools/" + modelName, "inventory");
}
}
}
@@ -68,7 +68,7 @@ public class FlowerColorAllele implements IFlowerColour, IAlleleInteger {
}
@Override
public String getColourName() {
public String getColorName() {
return I18N.localise("botany.colour." + getName());
}
}
@@ -6,23 +6,22 @@ import net.minecraft.item.ItemStack;
import binnie.botany.Botany;
import binnie.core.item.IItemMiscProvider;
import binnie.core.util.I18N;
public enum BotanyItems implements IItemMiscProvider {
AshPowder("Ash Powder", "powder_ash"),
PulpPowder("Wood Pulp Powder", "powder_pulp"),
MulchPowder("Mulch Powder", "powder_mulch"),
SulphurPowder("Sulphur Powder", "powder_sulphur"),
FertiliserPowder("Fertiliser Powder", "powder_fertiliser"),
CompostPowder("Compost Powder", "powder_compost"),
Mortar("Mortar", "mortar"),
Weedkiller("Weedkiller", "weedkiller");
AshPowder("powder_ash"),
PulpPowder("powder_pulp"),
MulchPowder("powder_mulch"),
SulphurPowder("powder_sulphur"),
FertiliserPowder("powder_fertiliser"),
CompostPowder("powder_compost"),
Mortar("mortar"),
Weedkiller("weedkiller");
String name;
String modelPath;
BotanyItems(String name, String modelPath) {
BotanyItems(String name) {
this.name = name;
this.modelPath = modelPath;
}
@Override
@@ -30,13 +29,13 @@ public enum BotanyItems implements IItemMiscProvider {
}
@Override
public String getName(ItemStack stack) {
return this.name;
public String getDisplayName(ItemStack stack) {
return I18N.localise("item.botany." + name + ".name");
}
@Override
public String getModelPath() {
return modelPath;
return name;
}
@Override
@@ -14,39 +14,43 @@ import forestry.core.items.IColoredItem;
import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.util.I18N;
public class ItemClay extends Item implements IColoredItem, IItemModelRegister {
public ItemClay() {
this.setUnlocalizedName("clay");
this.setUnlocalizedName("botany.clay");
this.setHasSubtypes(true);
this.setCreativeTab(CreativeTabBotany.instance);
setRegistryName("clay");
this.setRegistryName("clay");
}
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
for (EnumFlowerColor c : EnumFlowerColor.values()) {
manager.registerItemModel(item, c.ordinal());
for (EnumFlowerColor color : EnumFlowerColor.values()) {
manager.registerItemModel(item, color.ordinal());
}
}
@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
public String getItemStackDisplayName(final ItemStack stack) {
return EnumFlowerColor.get(stack.getItemDamage()).getFlowerColorAllele().getColourName() + " " + super.getItemStackDisplayName(stack);
}
EnumFlowerColor color = EnumFlowerColor.get(stack.getItemDamage());
return I18N.localise("item.botany.clay.name", color.getFlowerColorAllele().getColorName());
//return EnumFlowerColor.get(stack.getItemDamage()).getFlowerColorAllele().getColorName() + " " + super.getItemStackDisplayName(stack);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(final Item itemIn, final CreativeTabs tab, final NonNullList<ItemStack> list) {
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
list.add(new ItemStack(this, 1, c.ordinal()));
for (EnumFlowerColor color : EnumFlowerColor.values()) {
list.add(new ItemStack(this, 1, color.ordinal()));
}
}
}
@@ -14,39 +14,42 @@ import forestry.core.items.IColoredItem;
import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.util.I18N;
public class ItemPigment extends Item implements IItemModelRegister, IColoredItem {
public ItemPigment() {
this.setUnlocalizedName("pigment");
this.setUnlocalizedName("botany.pigment");
this.setHasSubtypes(true);
this.setCreativeTab(CreativeTabBotany.instance);
setRegistryName("pigment");
this.setRegistryName("pigment");
}
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
manager.registerItemModel(item, c.ordinal());
for (EnumFlowerColor color : EnumFlowerColor.values()) {
manager.registerItemModel(item, color.ordinal());
}
}
@SideOnly(Side.CLIENT)
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
return EnumFlowerColor.get(stack.getItemDamage()).getFlowerColorAllele().getColor(false);
EnumFlowerColor color = EnumFlowerColor.get(stack.getItemDamage());
return color.getFlowerColorAllele().getColor(false);
}
@Override
public String getItemStackDisplayName(final ItemStack stack) {
return EnumFlowerColor.get(stack.getItemDamage()).getFlowerColorAllele().getColourName() + " " + super.getItemStackDisplayName(stack);
EnumFlowerColor color = EnumFlowerColor.get(stack.getItemDamage());
return I18N.localise("item.botany.pigment.name", color.getFlowerColorAllele().getColorName());
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(final Item itemIn, final CreativeTabs tab, final NonNullList<ItemStack> list) {
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
list.add(new ItemStack(this, 1, c.ordinal()));
for (EnumFlowerColor color : EnumFlowerColor.values()) {
list.add(new ItemStack(this, 1, color.ordinal()));
}
}
}
@@ -5,11 +5,11 @@ import net.minecraft.item.ItemStack;
public interface IItemEnum {
boolean isActive();
String getName(final ItemStack p0);
String getDisplayName(ItemStack stack);
int ordinal();
ItemStack get(final int p0);
ItemStack get(int amount);
String name();
}
+1 -1
View File
@@ -61,6 +61,6 @@ public class ItemMisc extends ItemCore {
@Override
public String getItemStackDisplayName(final ItemStack stack) {
IItemMiscProvider item = this.getItem(stack.getItemDamage());
return item.getName(stack);
return item.getDisplayName(stack);
}
}
@@ -380,7 +380,7 @@ public class PlankType {
}
@Override
public String getName() {
public String getDisplayName() {
return I18N.localise("extratrees.block.planks.ebxl." + this.toString().toLowerCase());
}
@@ -21,7 +21,7 @@ public class GlassType implements IDesignMaterial {
GlassType.types.put(c.ordinal(), new GlassType(c.ordinal(), c.name, c.colour));
}
for (final EnumFlowerColor c2 : EnumFlowerColor.values()) {
GlassType.types.put(128 + c2.ordinal(), new GlassType(128 + c2.ordinal(), c2.getFlowerColorAllele().getColourName(), c2.getFlowerColorAllele().getColor(false)));
GlassType.types.put(128 + c2.ordinal(), new GlassType(128 + c2.ordinal(), c2.getFlowerColorAllele().getColorName(), c2.getFlowerColorAllele().getColor(false)));
}
}
@@ -39,7 +39,7 @@ public enum ExtraTreeItems implements IItemMiscProvider {
}
@Override
public String getName(final ItemStack stack) {
public String getDisplayName(final ItemStack stack) {
return I18N.localise("extratrees.item." + name + ".name");
}
@@ -151,7 +151,7 @@ public enum Food implements IItemMiscProvider {
}
@Override
public String getName(final ItemStack stack) {
public String getDisplayName(final ItemStack stack) {
return I18N.localise("extratrees.item.food." + this.name().toLowerCase());
}
@@ -57,7 +57,7 @@ public class ItemETFood extends ItemFood implements IItemModelRegister {
@Override
public String getItemStackDisplayName(ItemStack itemStack) {
IItemMiscProvider item = this.getItem(itemStack.getItemDamage());
return item.getName(itemStack);
return item.getDisplayName(itemStack);
}
@SideOnly(Side.CLIENT)
@@ -39,7 +39,7 @@ public enum GeneticsItems implements IItemMiscProvider {
}
@Override
public String getName(final ItemStack stack) {
public String getDisplayName(final ItemStack stack) {
return this.name;
}