mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-14 01:14:21 +00:00
* Added missing ru_RU localization * Fixed first letter * Rename Binnie.Language to short Binnie.I18N Removed some unused methods, classes. Removed some hardcod strings, replaced it on i18n Moved pigment colors of blocks and items to tooltips * #30 Fix some bugged localizations * #30 Added localization for PageSpeciesFlowerGenome * #30 Fixed some format in lang * #30 Added localization for ItemBotany and ItemPollen * Added localization for ItemGermling
This commit is contained in:
1 parent
7fe97e9323
commit
5e4d271f37
13 files changed
+128
-58
No files matched your search
@@ -41,9 +41,8 @@ public class BlockCeramic extends Block implements IBlockMetadata {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
// TODO replace deprecated
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||
|
||||
protected ControlColourMixSymbol(IWidget parent, int x, int y, int type) {
|
||||
super(parent, x, y, 16 + type * 16, 16.0f);
|
||||
value = null;
|
||||
this.type = type;
|
||||
value = null;
|
||||
addAttribute(WidgetAttribute.MouseOver);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class PageColourMix extends PageAbstract<IFlowerColor> {
|
||||
|
||||
@Override
|
||||
public void onValueChanged(IFlowerColor colour) {
|
||||
List<IColourMix> mixes = new ArrayList<IColourMix>();
|
||||
List<IColourMix> mixes = new ArrayList<>();
|
||||
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||
if (mix.getColor1() == colour || mix.getColor2() == colour) {
|
||||
mixes.add(mix);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package binnie.botany.craftgui;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
@@ -44,8 +45,8 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
|
||||
int w = 144;
|
||||
int h = 176;
|
||||
// TODO localise
|
||||
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), "Genome", TextJustification.MiddleCenter);
|
||||
|
||||
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome"), TextJustification.MiddleCenter);
|
||||
ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
|
||||
Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
|
||||
|
||||
@@ -54,29 +55,31 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
int w3 = tw - 50;
|
||||
int y = 0;
|
||||
int th = 14;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Temp. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MiddleLeft);
|
||||
int valueX = w2 + 4;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.temp"), TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Moist. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), Binnie.I18N.localise(treeSpecies.getMoisture()), TextJustification.MiddleLeft);
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.moist"), TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), Binnie.I18N.localise(treeSpecies.getMoisture()), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "pH. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), Binnie.I18N.localise(treeSpecies.getPH()), TextJustification.MiddleLeft);
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.ph"), TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), Binnie.I18N.localise(treeSpecies.getPH()), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Fertility : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MiddleLeft);
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.fertility"), TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), genome.getFertility() + "x", TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
|
||||
float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Lifespan : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), "" + String.format("%.2f", lifespan) + " days", TextJustification.MiddleLeft);
|
||||
String lifespanValue = String.format("%.2f", lifespan);
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.lifespan"), TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.lifespan.value", lifespanValue), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Nectar : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MiddleLeft);
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.nectar"), TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
|
||||
int x = w2;
|
||||
@@ -96,7 +99,7 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
}
|
||||
|
||||
int numOfLines = 1 + (tot - 1) / 3;
|
||||
new ControlText(contents, new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), "Varieties : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.varieties"), TextJustification.MiddleRight);
|
||||
y += th;
|
||||
contents.setSize(new IPoint(contents.size().x(), y));
|
||||
scrollable.setScrollableContent(contents);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
@Override
|
||||
protected void addTabs() {
|
||||
new PageSpeciesOverview(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.overview", 0));
|
||||
new PageSpeciesFlowerGenome(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.genome", 0));
|
||||
new PageSpeciesFlowerGenome(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "genome", 0));
|
||||
new PageSpeciesClassification(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.classification", 0));
|
||||
new PageSpeciesResultant(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.resultant", 0));
|
||||
new PageSpeciesMutations(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.further", 0));
|
||||
@@ -65,7 +65,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Botany.proxy.localise("gui.database.mode." + name().toLowerCase());
|
||||
return Botany.proxy.localise("gui.database.tab." + name().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,13 +68,13 @@ public abstract class ItemBotany extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) {
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List tooltip, boolean flag) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return;
|
||||
}
|
||||
IFlower individual = (IFlower) getIndividual(itemstack);
|
||||
if (individual == null) {
|
||||
list.add("This item is bugged. Destroy it!");
|
||||
tooltip.add(Binnie.I18N.localise(Botany.instance, "item.tooltip.bugged"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,17 +82,16 @@ public abstract class ItemBotany extends Item {
|
||||
IFlowerColor primaryColor = genome.getPrimaryColor();
|
||||
IFlowerColor secondColor = genome.getSecondaryColor();
|
||||
IFlowerColor stemColor = genome.getStemColor();
|
||||
list.add(EnumChatFormatting.YELLOW + primaryColor.getName() + ((primaryColor == secondColor) ? "" : (" and " + secondColor.getName())) + ", " + stemColor.getName() + " Stem");
|
||||
tooltip.add(EnumChatFormatting.YELLOW + primaryColor.getName() + ((primaryColor == secondColor) ? "" : (" and " + secondColor.getName())) + ", " + stemColor.getName() + " Stem");
|
||||
|
||||
if (individual.isAnalyzed()) {
|
||||
if (BinnieCore.proxy.isShiftDown()) {
|
||||
individual.addTooltip(list);
|
||||
individual.addTooltip(tooltip);
|
||||
} else {
|
||||
// TODO remove hardcode strings and localize
|
||||
list.add(EnumChatFormatting.GRAY + "<Hold shift for details>");
|
||||
tooltip.add(EnumChatFormatting.GRAY + Binnie.I18N.localise(Botany.instance, "item.tooltip.holdMore"));
|
||||
}
|
||||
} else {
|
||||
list.add("<Unknown>");
|
||||
tooltip.add(Binnie.I18N.localise(Botany.instance, "item.tooltip.unknownGenome"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,12 +115,18 @@ public abstract class ItemBotany extends Item {
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return "Unknown";
|
||||
return Binnie.I18N.localise(Botany.instance, "item.tooltip.unknown");
|
||||
}
|
||||
|
||||
IIndividual individual = getIndividual(itemstack);
|
||||
return (individual != null && individual.getGenome() != null) ?
|
||||
(individual.getDisplayName() + getTag()) :
|
||||
"Corrupted Flower";
|
||||
if (individual != null && individual.getGenome() != null) {
|
||||
String tag = getTag();
|
||||
if (tag == null || tag.isEmpty()) {
|
||||
return individual.getDisplayName();
|
||||
}
|
||||
return Binnie.I18N.localise(Botany.instance, "item.botany.name", individual.getDisplayName(), tag);
|
||||
}
|
||||
return Binnie.I18N.localise(Botany.instance, "item.flowerCorrupted.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -195,7 +200,7 @@ public abstract class ItemBotany extends Item {
|
||||
}
|
||||
pollinatable.mateWith(flower);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
--itemstack.stackSize;
|
||||
itemstack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -264,14 +269,14 @@ public abstract class ItemBotany extends Item {
|
||||
}
|
||||
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
Block field_150939_a = Botany.flower;
|
||||
if (!world.setBlock(x, y, z, field_150939_a, metadata, 3)) {
|
||||
Block block = Botany.flower;
|
||||
if (!world.setBlock(x, y, z, block, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlock(x, y, z) == field_150939_a) {
|
||||
field_150939_a.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
field_150939_a.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
if (world.getBlock(x, y, z) == block) {
|
||||
block.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
block.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package binnie.botany.flower;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
public class ItemPollen extends ItemBotany {
|
||||
@@ -14,6 +16,6 @@ public class ItemPollen extends ItemBotany {
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return " Pollen";
|
||||
return Binnie.I18N.localise(Botany.instance, "item.pollen.tag.name");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package binnie.botany.flower;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
public class ItemSeed extends ItemBotany {
|
||||
@@ -14,6 +16,6 @@ public class ItemSeed extends ItemBotany {
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return " Germling";
|
||||
return Binnie.I18N.localise(Botany.instance, "item.germling.tag.name");
|
||||
}
|
||||
}
|
||||
@@ -216,15 +216,15 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
flower.setWilted(false);
|
||||
}
|
||||
|
||||
float CHANCE_DISPERSAL = 0.8f;
|
||||
CHANCE_DISPERSAL += 0.2f * flower.getGenome().getFertility();
|
||||
CHANCE_DISPERSAL *= 1.0f + soil.ordinal() * 0.5f;
|
||||
float CHANCE_POLLINATE = 1.0f;
|
||||
CHANCE_POLLINATE += 0.25f * flower.getGenome().getFertility();
|
||||
CHANCE_POLLINATE *= 1.0f + soil.ordinal() * 0.5f;
|
||||
float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE;
|
||||
float chanceDispersal = 0.8f;
|
||||
chanceDispersal += 0.2f * flower.getGenome().getFertility();
|
||||
chanceDispersal *= 1.0f + soil.ordinal() * 0.5f;
|
||||
float chancePollinate = 1.0f;
|
||||
chancePollinate += 0.25f * flower.getGenome().getFertility();
|
||||
chancePollinate *= 1.0f + soil.ordinal() * 0.5f;
|
||||
float chanceSelfPollinate = 0.2f * chancePollinate;
|
||||
|
||||
if (worldObj.rand.nextFloat() < CHANCE_DISPERSAL && flower.hasFlowered() && !flower.isWilted()) {
|
||||
if (worldObj.rand.nextFloat() < chanceDispersal && flower.hasFlowered() && !flower.isWilted()) {
|
||||
IFlowerGenome mate = flower.getMate();
|
||||
if (mate != null) {
|
||||
boolean dispersed = false;
|
||||
@@ -250,7 +250,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
}
|
||||
}
|
||||
|
||||
if (worldObj.rand.nextFloat() < CHANCE_POLLINATE && flower.hasFlowered() && !flower.isWilted()) {
|
||||
if (worldObj.rand.nextFloat() < chancePollinate && flower.hasFlowered() && !flower.isWilted()) {
|
||||
for (int a2 = 0; a2 < 4; ++a2) {
|
||||
int dx3 = 0;
|
||||
int dz2 = 0;
|
||||
@@ -266,7 +266,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
}
|
||||
}
|
||||
|
||||
if (worldObj.rand.nextFloat() < CHANCE_SELFPOLLINATE && flower.hasFlowered() && flower.getMate() == null) {
|
||||
if (worldObj.rand.nextFloat() < chanceSelfPollinate && flower.hasFlowered() && flower.getMate() == null) {
|
||||
mateWith(getFlower());
|
||||
}
|
||||
spawnButterflies();
|
||||
@@ -635,5 +635,4 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user