mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-20 20:22:35 +00:00
Localization and refactoring (#77)
* Some refactoring for bee production * Code cleanup * Code cleanup * Added some localization * Fix wrong dropped class * Added some localization * Added some localization * Added some localization * Fix wrong import
This commit is contained in:
1 parent
68bbe7710c
commit
1ea7b62e5f
157 files changed
+3240
-5045
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extrabees.gui.punnett;
|
||||
package binnie.extrabees.gui;
|
||||
|
||||
public enum ExtraBeeGUITexture {
|
||||
Chromosome,
|
||||
@@ -1,48 +0,0 @@
|
||||
package binnie.extrabees.gui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
// TODO unused class?
|
||||
public class WindowAlvearyIndustrialFrame extends Window {
|
||||
protected Machine machine;
|
||||
protected ControlPlayerInventory playerInventory;
|
||||
|
||||
public WindowAlvearyIndustrialFrame(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(176.0f, 144.0f, player, inventory, side);
|
||||
machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyIndustrialFrame(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle("Industrial Frame Housing");
|
||||
playerInventory = new ControlPlayerInventory(this);
|
||||
ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
|
||||
slot.assign(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return ExtraBees.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AlvearyIndustrialFrame";
|
||||
}
|
||||
}
|
||||
@@ -48,31 +48,4 @@ public class WindowApiaristDatabase extends WindowAbstractDatabase {
|
||||
public String getName() {
|
||||
return "Database";
|
||||
}
|
||||
|
||||
// TODO unused class?
|
||||
enum SpeciesTab {
|
||||
Overview(0xff),
|
||||
Genome(0xffff00),
|
||||
Productivity(0xffff),
|
||||
Climate(0xff0000),
|
||||
ResultantMutations(0xff00ff),
|
||||
FurtherMutations(0xff00);
|
||||
|
||||
public int colour;
|
||||
|
||||
SpeciesTab(int colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
}
|
||||
|
||||
enum BranchesTab {
|
||||
Overview(255),
|
||||
Species(16711680);
|
||||
|
||||
public int colour;
|
||||
|
||||
BranchesTab(int colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package binnie.extrabees.gui.punnett;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.controls.core.IControlValue;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
|
||||
// TODO unused class?
|
||||
public class ControlChromosome extends Control implements IControlValue<IChromosomeType>, ITooltip {
|
||||
protected IChromosomeType value;
|
||||
|
||||
protected ControlChromosome(IWidget parent, float x, float y, IChromosomeType type) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
setValue(type);
|
||||
addAttribute(WidgetAttribute.MouseOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(IChromosomeType value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome, getArea());
|
||||
CraftGUI.Render.colour(0xff0000);
|
||||
CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome2, getArea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
if (value != null) {
|
||||
tooltip.add(value.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package binnie.extrabees.gui.punnett;
|
||||
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.geometry.TextJustification;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ControlPunnett extends Control {
|
||||
protected static int boxWidth = 80;
|
||||
protected static int boxHeight = 28;
|
||||
|
||||
protected ControlPunnett(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, ControlPunnett.boxWidth * 3, ControlPunnett.boxWidth * 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.solid(new IArea(0.0f, ControlPunnett.boxHeight, ControlPunnett.boxWidth * 3, 1.0f), 11184810);
|
||||
CraftGUI.Render.solid(new IArea(ControlPunnett.boxWidth / 2.0f, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth * 2.5f, 1.0f), 11184810);
|
||||
CraftGUI.Render.solid(new IArea(ControlPunnett.boxWidth, 0.0f, 1.0f, ControlPunnett.boxHeight * 3), 11184810);
|
||||
CraftGUI.Render.solid(new IArea(ControlPunnett.boxWidth * 2, ControlPunnett.boxHeight / 2.0f, 1.0f, ControlPunnett.boxHeight * 2.5f), 11184810);
|
||||
}
|
||||
|
||||
// TODO unused method?
|
||||
public void setup(IChromosomeType chromosome, IIndividual ind1, IIndividual ind2, ISpeciesRoot root) {
|
||||
deleteAllChildren();
|
||||
if (chromosome == null || ind1 == null || ind2 == null || root == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome);
|
||||
IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome);
|
||||
IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome);
|
||||
IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome);
|
||||
int x = 1;
|
||||
int y;
|
||||
|
||||
for (IAllele allele1 : new IAllele[]{primary1, secondary1}) {
|
||||
y = 1;
|
||||
for (IAllele allele2 : new IAllele[]{primary2, secondary2}) {
|
||||
List<IAllele> alleles = new LinkedList<IAllele>();
|
||||
if (allele1.isDominant() && !allele2.isDominant()) {
|
||||
alleles.add(allele1);
|
||||
} else if (allele2.isDominant() && !allele1.isDominant()) {
|
||||
alleles.add(allele2);
|
||||
} else {
|
||||
alleles.add(allele1);
|
||||
if (allele1 != allele2) {
|
||||
alleles.add(allele2);
|
||||
}
|
||||
}
|
||||
|
||||
String text = "";
|
||||
for (IAllele allele3 : alleles) {
|
||||
text = text + allele3.getName() + ": " + 25.0f / alleles.size() + "%\n";
|
||||
}
|
||||
new ControlText(this, new IArea(x * ControlPunnett.boxWidth, ControlPunnett.boxHeight * y, ControlPunnett.boxWidth, ControlPunnett.boxHeight), text, TextJustification.TopCenter).setColor(11184810);
|
||||
y++;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
new ControlText(this, new IArea(ControlPunnett.boxWidth, 0.0f, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
new ControlText(this, new IArea(ControlPunnett.boxWidth * 2, 0.0f, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
new ControlText(this, new IArea(0.0f, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
new ControlText(this, new IArea(0.0f, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package binnie.extrabees.gui.punnett;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.craftgui.resource.StyleSheet;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
// TODO unused class?
|
||||
public class WindowPunnettSquare extends Window {
|
||||
ControlSlot bee1;
|
||||
ControlSlot bee2;
|
||||
ControlPunnett punnett;
|
||||
ISpeciesRoot root;
|
||||
|
||||
public WindowPunnettSquare(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(245.0f, 205.0f, player, inventory, side);
|
||||
root = null;
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowPunnettSquare(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return ExtraBees.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Punnett";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle("Punnett Square");
|
||||
CraftGUI.Render.stylesheet(new StyleSheetPunnett());
|
||||
}
|
||||
|
||||
static class StyleSheetPunnett extends StyleSheet {
|
||||
public StyleSheetPunnett() {
|
||||
textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, ExtraBeeTexture.GUIPunnett, 32, 32, 32, 32));
|
||||
textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, ExtraBeeTexture.GUIPunnett));
|
||||
textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user