Feature/refactoring (#79)

* Added some localization

* Added some localization

* Some refactoring
This commit is contained in:
Alexander Kornilov authored and mezz committed 2017-05-29 11:31:06 -07:00
1 parent 1ea7b62e5f
commit 618b291015
60 files changed
+261 -166

No files matched your search

@@ -62,7 +62,7 @@ public class WindowGenesis extends Window {
public void initialiseClient() {
new ControlPlayerInventory(this);
setTitle("Genesis");
ControlTabBar<BreedingSystem> tabSystems = new ControlTabBar<BreedingSystem>(this, 8.0f, 28.0f, 23.0f, 100.0f, Position.Left) {
ControlTabBar<BreedingSystem> tabSystems = new ControlTabBar<BreedingSystem>(this, 8.0f, 28.0f, 23.0f, 100.0f, Position.LEFT) {
@Override
public ControlTab<BreedingSystem> createTab(float x, float y, float w, float h, BreedingSystem value) {
return new ControlTabIcon<BreedingSystem>(this, x, y, w, h, value) {
@@ -48,7 +48,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
Texture iTexture = lTexture.crop(position, 8.0f);
IArea area = getArea();
if (texture == CraftGUITexture.TabDisabled) {
if (position == Position.Top || position == Position.Left) {
if (position == Position.TOP || position == Position.LEFT) {
area.setPosition(area.getPosition().sub(new IPoint(4 * position.x(), 4 * position.y())));
area.setSize(area.getSize().add(new IPoint(4 * position.x(), 4 * position.y())));
} else {
@@ -36,13 +36,13 @@ public class ControlTabBar<T> extends Control implements IControlValue<T> {
float length = values.size();
int tabDimension = (int) (getSize().y() / length);
if (position == Position.Top || position == Position.Bottom) {
if (position == Position.TOP || position == Position.BOTTOM) {
tabDimension = (int) (getSize().x() / length);
}
int j = 0;
for (T value : values) {
if (position == Position.Top || position == Position.Bottom) {
if (position == Position.TOP || position == Position.BOTTOM) {
createTab(j * tabDimension, 0.0f, tabDimension, getSize().y(), value);
} else {
createTab(0.0f, j * tabDimension, getSize().x(), tabDimension, value);
@@ -164,7 +164,7 @@ public abstract class WindowAbstractDatabase extends Window {
});
addTabs();
ControlTabBar<IDatabaseMode> tab = new ControlTabBar<IDatabaseMode>(this, 176.0f + selectionBoxWidth, 24.0f, 22.0f, 176.0f, Position.Right) {
ControlTabBar<IDatabaseMode> tab = new ControlTabBar<IDatabaseMode>(this, 176.0f + selectionBoxWidth, 24.0f, 22.0f, 176.0f, Position.RIGHT) {
@Override
public ControlTab<IDatabaseMode> createTab(float x, float y, float w, float h, IDatabaseMode value) {
return new ControlTab<IDatabaseMode>(this, x, y, w, h, value) {
@@ -180,7 +180,7 @@ public abstract class WindowAbstractDatabase extends Window {
CraftGUIUtil.linkWidgets(tab, modePages);
changeMode(Mode.Species);
for (IDatabaseMode mode : modes.keySet()) {
modes.get(mode).infoTabs = new ControlTabBar(modes.get(mode).modePage, 8.0f, 24.0f, 16.0f, 176.0f, Position.Left);
modes.get(mode).infoTabs = new ControlTabBar(modes.get(mode).modePage, 8.0f, 24.0f, 16.0f, 176.0f, Position.LEFT);
modes.get(mode).infoTabs.setValues(modes.get(mode).infoPages.getValues());
CraftGUIUtil.linkWidgets(modes.get(mode).infoTabs, modes.get(mode).infoPages);
}
@@ -28,7 +28,7 @@ public class IBorder {
}
public IBorder(Position edge, float n) {
this((edge == Position.Top) ? n : 0.0f, (edge == Position.Right) ? n : 0.0f, (edge == Position.Bottom) ? n : 0.0f, (edge == Position.Left) ? n : 0.0f);
this((edge == Position.TOP) ? n : 0.0f, (edge == Position.RIGHT) ? n : 0.0f, (edge == Position.BOTTOM) ? n : 0.0f, (edge == Position.LEFT) ? n : 0.0f);
}
public IBorder(IBorder padding) {
@@ -1,10 +1,10 @@
package binnie.core.craftgui.geometry;
public enum Position {
Top(0, -1),
Bottom(0, 1),
Left(-1, 0),
Right(1, 0);
TOP(0, -1),
BOTTOM(0, 1),
LEFT(-1, 0),
RIGHT(1, 0);
protected int x;
protected int y;
@@ -24,17 +24,17 @@ public enum Position {
public Position opposite() {
switch (this) {
case Bottom:
return Position.Top;
case BOTTOM:
return Position.TOP;
case Left:
return Position.Right;
case LEFT:
return Position.RIGHT;
case Right:
return Position.Left;
case RIGHT:
return Position.LEFT;
case Top:
return Position.Bottom;
case TOP:
return Position.BOTTOM;
}
return null;
}
@@ -1,5 +1,6 @@
package binnie.core.craftgui.minecraft.control;
import binnie.core.BinnieCore;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.IWidget;
@@ -16,6 +17,7 @@ import binnie.core.machines.Machine;
import binnie.core.machines.TileEntityMachine;
import binnie.core.machines.power.IPoweredMachine;
import binnie.core.machines.power.IProcess;
import binnie.core.util.I18N;
import net.minecraft.inventory.IInventory;
import org.lwjgl.opengl.GL11;
@@ -36,6 +38,7 @@ public class ControlEnergyBar extends Control implements ITooltip {
if (machine == null) {
return null;
}
IPoweredMachine clientPower = machine.getMachine().getInterface(IPoweredMachine.class);
return clientPower;
}
@@ -49,27 +52,34 @@ public class ControlEnergyBar extends Control implements ITooltip {
}
private float getStoredEnergy() {
return Window.get(this).getContainer().getPowerInfo().getStoredEnergy();
return Window.get(this)
.getContainer()
.getPowerInfo()
.getStoredEnergy();
}
private float getMaxEnergy() {
return Window.get(this).getContainer().getPowerInfo().getMaxEnergy();
return Window.get(this)
.getContainer()
.getPowerInfo()
.getMaxEnergy();
}
@Override
public void getTooltip(Tooltip tooltip) {
tooltip.add((int) getPercentage() + "% charged");
tooltip.add(getStoredEnergy() + "/" + getMaxEnergy() + " RF");
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.chargedPower", (int) getPercentage()));
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.powerInfo", getStoredEnergy(), getMaxEnergy()));
}
@Override
public void getHelpTooltip(Tooltip tooltip) {
tooltip.add("Energy Bar");
tooltip.add("Current: " + getStoredEnergy() + " RF (" + (int) getPercentage() + "%)");
tooltip.add("Capacity: " + getMaxEnergy() + " RF");
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.powerBar"));
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.currentPower", getStoredEnergy(), (int) getPercentage()));
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.capacityPower", getMaxEnergy()));
IProcess process = Machine.getInterface(IProcess.class, Window.get(this).getInventory());
if (process != null) {
tooltip.add("Usage: " + (int) process.getEnergyPerTick() + " RF");
tooltip.add(I18N.localise(BinnieCore.instance, "gui.tooltip.usagePower", (int) process.getEnergyPerTick()));
}
}
@@ -81,14 +91,14 @@ public class ControlEnergyBar extends Control implements ITooltip {
IArea area = getArea();
switch (direction) {
case Top:
case Bottom:
case TOP:
case BOTTOM:
float height = area.size().y() * percentage;
area.setSize(new IPoint(area.size().x(), height));
break;
case Left:
case Right:
case LEFT:
case RIGHT:
float width = area.size().x() * percentage;
area.setSize(new IPoint(width, area.size().y()));
break;
@@ -61,7 +61,7 @@ public class ControlSlide extends Control {
GL11.glPopMatrix();
}
CraftGUI.Render.texture(CraftGUITexture.Window, getArea());
Object slideTexture = (anchor == Position.Bottom) ? CraftGUITexture.SlideDown : ((anchor == Position.Top) ? CraftGUITexture.SlideUp : ((anchor == Position.Left) ? CraftGUITexture.SlideLeft : CraftGUITexture.SlideRight));
Object slideTexture = (anchor == Position.BOTTOM) ? CraftGUITexture.SlideDown : ((anchor == Position.TOP) ? CraftGUITexture.SlideUp : ((anchor == Position.LEFT) ? CraftGUITexture.SlideLeft : CraftGUITexture.SlideRight));
CraftGUI.Render.texture(slideTexture, new IPoint((anchor.x() + 1.0f) * w() / 2.0f - 8.0f, (anchor.y() + 1.0f) * h() / 2.0f - 8.0f));
}
@@ -21,7 +21,7 @@ public class ControlSlotCharge extends Control {
@Override
public void onRenderBackground() {
CraftGUI.Render.texture(CraftGUITexture.PanelBlack, getArea());
CraftGUI.Render.texturePercentage(CraftGUI.Render.getTexture(CraftGUITexture.SlotCharge), getArea().inset(1), Position.Bottom, getCharge());
CraftGUI.Render.texturePercentage(CraftGUI.Render.getTexture(CraftGUITexture.SlotCharge), getArea().inset(1), Position.BOTTOM, getCharge());
}
public ControlSlotCharge(IWidget parent, int x, int y, int slot) {
@@ -190,28 +190,28 @@ public class Renderer {
}
public void texturePercentage(Texture texture, IArea area, Position direction, float percentage) {
float dist = (direction == Position.Top || direction == Position.Bottom) ? (percentage * texture.h()) : (percentage * texture.w());
float dim = (direction == Position.Top || direction == Position.Bottom) ? texture.h() : texture.w();
float dist = (direction == Position.TOP || direction == Position.BOTTOM) ? (percentage * texture.h()) : (percentage * texture.w());
float dim = (direction == Position.TOP || direction == Position.BOTTOM) ? texture.h() : texture.w();
float x = area.pos().x();
float y = area.pos().y();
float w = area.size().x();
float h = area.size().y();
switch (direction) {
case Top:
case TOP:
h *= percentage;
break;
case Right:
case RIGHT:
x += (1.0f - percentage) * w;
w *= percentage;
break;
case Left:
case LEFT:
w *= percentage;
break;
case Bottom:
case BOTTOM:
y += h - (int) (percentage * h);
h *= percentage;
break;
@@ -122,6 +122,10 @@ public class ErrorState implements INBTTagable {
}
public static class NoSpace extends Item {
public NoSpace(String desc, int slot) {
super(I18N.localise(BinnieCore.instance, "machine.error.noSpace"), desc, new int[]{slot});
}
public NoSpace(String desc, int[] slots) {
super(I18N.localise(BinnieCore.instance, "machine.error.noSpace"), desc, slots);
}
@@ -104,7 +104,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
int compartmentHeight = compartmentPageHeight;
Control controlCompartment = new Control(this, x, y, compartmentWidth, compartmentHeight);
ControlTabBar<Integer> tab = new ControlTabBar<Integer>(controlCompartment, 0.0f, 0.0f, 24.0f, compartmentPageHeight, Position.Left) {
ControlTabBar<Integer> tab = new ControlTabBar<Integer>(controlCompartment, 0.0f, 0.0f, 24.0f, compartmentPageHeight, Position.LEFT) {
@Override
public ControlTab<Integer> createTab(float x, float y, float w, float h, Integer value) {
return new ControlTabIcon<Integer>(this, x, y, w, h, value) {
@@ -173,7 +173,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
}
x += compartmentPageWidth;
if (tabs2.length > 0) {
ControlTabBar<Integer> tab2 = new ControlTabBar<Integer>(controlCompartment, 24 + compartmentPageWidth, 0.0f, 24.0f, compartmentPageHeight, Position.Right) {
ControlTabBar<Integer> tab2 = new ControlTabBar<Integer>(controlCompartment, 24 + compartmentPageWidth, 0.0f, 24.0f, compartmentPageHeight, Position.RIGHT) {
@Override
public ControlTab<Integer> createTab(float x, float y, float w, float h, Integer value) {
return new ControlTabIcon<Integer>(this, x, y, w, h, value) {
@@ -219,7 +219,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
setSize(new IPoint(Math.max(32 + compartmentWidth, 252), h()));
controlCompartment.setPosition(new IPoint((w() - controlCompartment.w()) / 2.0f, controlCompartment.y()));
ControlPlayerInventory invent = new ControlPlayerInventory(this, true);
ControlSlide slide = new ControlSlide(this, 0.0f, 134.0f, 136.0f, 92.0f, Position.Left);
ControlSlide slide = new ControlSlide(this, 0.0f, 134.0f, 136.0f, 92.0f, Position.LEFT);
slide.setLabel("Tab Properties");
slide.setSlide(false);
slide.addHelp("Tab Properties");
@@ -296,7 +296,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
@Override
public void onRenderBackground() {
Object texture = isMouseOver() ? CraftGUITexture.TabHighlighted : CraftGUITexture.Tab;
CraftGUI.Render.texture(CraftGUI.Render.getTexture(texture).crop(Position.Bottom, 8.0f), getArea());
CraftGUI.Render.texture(CraftGUI.Render.getTexture(texture).crop(Position.BOTTOM, 8.0f), getArea());
}
};
searchButton.addHelp("Search Button");
@@ -33,7 +33,7 @@ public class WindowAlvearyStimulator extends Window {
@Override
public void initialiseClient() {
setTitle("Stimulator");
new ControlEnergyBar(this, 75, 29, 60, 16, Position.Left);
new ControlEnergyBar(this, 75, 29, 60, 16, Position.LEFT);
ControlSlot slot = new ControlSlot(this, 41.0f, 28.0f);
slot.assign(AlvearyStimulator.slotCircuit);
playerInventory = new ControlPlayerInventory(this);
@@ -49,7 +49,7 @@ public class ControlDistilleryProgress extends ControlProgressBase {
@Override
public void onRenderBackground() {
CraftGUI.Render.texture(ControlDistilleryProgress.DistilleryBase, new IPoint(0.0f, 0.0f));
CraftGUI.Render.texturePercentage(ControlDistilleryProgress.LiquidFlow, new IArea(18.0f, 0.0f, 38.0f, 66.0f), Position.Left, progress);
CraftGUI.Render.texturePercentage(ControlDistilleryProgress.LiquidFlow, new IArea(18.0f, 0.0f, 38.0f, 66.0f), Position.LEFT, progress);
Distillery.ComponentDistilleryLogic component = Machine.getInterface(Distillery.ComponentDistilleryLogic.class, Window.get(this).getInventory());
FluidStack stack = null;
if (component != null) {
@@ -43,7 +43,7 @@ public class WindowBrewery extends Window {
new ControlSlot(this, 105.0f, 77.0f).assign(Brewery.slotRecipeYeast);
new ControlLiquidTank(this, 76, 32).setTankID(Brewery.tankInput);
new ControlLiquidTank(this, 162, 32).setTankID(Brewery.tankOutput);
new ControlEnergyBar(this, 196, 32, 16, 60, Position.Bottom);
new ControlEnergyBar(this, 196, 32, 16, 60, Position.BOTTOM);
new ControlBreweryProgress(this, 110.0f, 32.0f);
new ControlSlotArray(this, (int) (getSize().x() / 2.0f - 81.0f), 104, 9, 1).create(Brewery.slotInventory);
new ControlPlayerInventory(this);
@@ -43,7 +43,7 @@ public class WindowDistillery extends Window {
x += 64;
new ControlLiquidTank(this, x, 35).setTankID(Distillery.tankOutput);
x += 34;
new ControlEnergyBar(this, x, 36, 60, 16, Position.Left);
new ControlEnergyBar(this, x, 36, 60, 16, Position.LEFT);
new ControlPlayerInventory(this);
new ControlErrorState(this, x + 21, 62.0f);
}
@@ -43,7 +43,7 @@ public class WindowLumbermill extends Window {
new ControlSlot(this, 172.0f, 58.0f).assign(Lumbermill.slotSawdust);
new ControlLumbermillProgress(this, 70.0f, 43.0f);
new ControlLiquidTank(this, 16, 32);
new ControlEnergyBar(this, 8, 112, 16, 60, Position.Bottom);
new ControlEnergyBar(this, 8, 112, 16, 60, Position.BOTTOM);
new ControlPlayerInventory(this);
new ControlErrorState(this, 95.0f, 73.0f);
}
@@ -42,7 +42,7 @@ public class WindowPress extends Window {
setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName());
new ControlSlot(this, 24.0f, 52.0f).assign(Press.slotFruit);
new ControlLiquidTank(this, 99, 32).setTankID(Press.tankWater);
new ControlEnergyBar(this, 154, 32, 16, 60, Position.Bottom);
new ControlEnergyBar(this, 154, 32, 16, 60, Position.BOTTOM);
new ControlPlayerInventory(this);
new ControlErrorState(this, 128.0f, 54.0f);
new ControlFruitPressProgress(this, 62.0f, 24.0f);
@@ -153,7 +153,7 @@ public class Lumbermill {
if (!getUtil().isSlotEmpty(Lumbermill.slotPlanks) && result != null) {
ItemStack currentPlank = getUtil().getStack(Lumbermill.slotPlanks);
if (!result.isItemEqual(currentPlank) || result.stackSize + currentPlank.stackSize > currentPlank.getMaxStackSize()) {
return new ErrorState.NoSpace("No room for new planks", new int[]{Lumbermill.slotPlanks});
return new ErrorState.NoSpace("No room for new planks", Lumbermill.slotPlanks);
}
}
return super.canWork();
+2 -2
View File
@@ -39,7 +39,7 @@ public class Genetics extends AbstractMod {
public static Proxy proxy;
public static ItemSerumArray itemSerumArray = null;
public static String channel = "GEN";
public static final String CHANNEL = "GEN";
public static Item itemGenetics;
public static Item itemSerum;
public static Item itemSequencer;
@@ -84,7 +84,7 @@ public class Genetics extends AbstractMod {
@Override
public String getChannel() {
return "GEN";
return CHANNEL;
}
@Override
@@ -8,14 +8,14 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class CreativeTabGenetics extends CreativeTabs {
public class GeneticsCreativeTab extends CreativeTabs {
public static CreativeTabs instance;
static {
CreativeTabGenetics.instance = new CreativeTabGenetics();
GeneticsCreativeTab.instance = new GeneticsCreativeTab();
}
public CreativeTabGenetics() {
public GeneticsCreativeTab() {
super("Genetics");
}
@@ -32,16 +32,16 @@ public class WindowAcclimatiser extends WindowMachine {
@Override
public void initialiseClient() {
setTitle(I18N.localise(Genetics.instance, "machine.labMachine.acclimatiser"));
setTitle(getTitle());
int x = 59;
int y = 32;
new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.SLOT_RESERVE);
x += 54;
new ControlSlot(this, x + 18, y).assign(4);
new ControlSlot(this, x + 18, y).assign(Acclimatiser.SLOT_TARGET);
new ControlSlotArray(this, x, y + 18 + 18, 3, 1).create(Acclimatiser.SLOT_ACCLIMATISER);
x += 72;
new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.SLOT_DONE);
new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
new ControlEnergyBar(this, 21, 115, 16, 60, Position.BOTTOM);
new ControlErrorState(this, 181.0f, 83.0f);
new ControlPlayerInventory(this);
}
@@ -58,6 +58,6 @@ public class WindowAcclimatiser extends WindowMachine {
@Override
protected String getName() {
return I18N.localise(Genetics.instance, "machine.labMachine.acclimatiser");
return getTitle();
}
}
@@ -16,6 +16,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlotCharge;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.craftgui.window.Panel;
import binnie.core.util.I18N;
import binnie.extrabees.core.ExtraBeeTexture;
import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsTexture;
@@ -25,8 +26,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
public class WindowAnalyser extends WindowMachine {
protected static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, ExtraBeeTexture.GUIProgress.getTexture());
protected static Texture Progress = new StandardTexture(0, 201, 142, 17, ExtraBeeTexture.GUIProgress.getTexture());
protected static Texture progressBase = new StandardTexture(0, 218, 142, 17, ExtraBeeTexture.GUIProgress.getTexture());
protected static Texture progress = new StandardTexture(0, 201, 142, 17, ExtraBeeTexture.GUIProgress.getTexture());
public WindowAnalyser(EntityPlayer player, IInventory inventory, Side side) {
super(220, 210, player, inventory, side);
@@ -38,33 +39,32 @@ public class WindowAnalyser extends WindowMachine {
@Override
public void initialiseClient() {
WindowAnalyser.ProgressBase = new StandardTexture(0, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
WindowAnalyser.Progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
setTitle(getTitle());
WindowAnalyser.progressBase = new StandardTexture(0, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
WindowAnalyser.progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
int x = 16;
int y = 32;
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_RESERVE);
x += 28;
new ControlSlot(this, x, y + 54 + 8).assign(13);
new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColor(10040319);
new ControlEnergyBar(this, x + 24 + 16, y + 54 + 8 + 1, 60, 16, Position.Left);
new ControlEnergyBar(this, x + 24 + 16, y + 54 + 8 + 1, 60, 16, Position.LEFT);
new ControlErrorState(this, x + 24 + 16 + 60 + 16, y + 54 + 8 + 1);
x -= 28;
new ControlIconDisplay(this, x + 36 + 2, y + 18, GUIIcon.ArrowRight.getIcon());
x += 56;
new Panel(this, x, y, 76.0f, 50.0f, MinecraftGUI.PanelType.Tinted);
new ControlProgress(this, x + 5, y + 5, WindowAnalyser.ProgressBase, WindowAnalyser.Progress, Position.Left);
new ControlSlot(this, x + 38 - 9, y + 25 - 9).assign(6);
new ControlProgress(this, x + 5, y + 5, WindowAnalyser.progressBase, WindowAnalyser.progress, Position.LEFT);
new ControlSlot(this, x + 38 - 9, y + 25 - 9).assign(Analyser.SLOT_TARGET);
new ControlIconDisplay(this, x + 76 + 2, y + 18, GUIIcon.ArrowRight.getIcon());
x += 96;
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_FINISHED);
x += 52;
setTitle("Analyser");
new ControlPlayerInventory(this);
}
@Override
public String getTitle() {
return "Analyser";
return I18N.localise(Genetics.instance, "machine.labMachine.analyser");
}
@Override
@@ -74,6 +74,6 @@ public class WindowAnalyser extends WindowMachine {
@Override
protected String getName() {
return "Analyser";
return getTitle();
}
}
@@ -113,7 +113,7 @@ public class WindowGeneBank extends WindowMachine {
}.setOrigin(EventHandler.Origin.Self, edit));
scroll.setScrollableContent(genes = new ControlGeneScroll(scroll, 1.0f, 1.0f, geneBoxWidth, 116.0f));
genes.setGenes(Binnie.Genetics.beeBreedingSystem);
ControlTabBar<BreedingSystem> tabBar = new ControlTabBar<BreedingSystem>(this, boxX, 32.0f, 24.0f, 120.0f, Position.Left) {
ControlTabBar<BreedingSystem> tabBar = new ControlTabBar<BreedingSystem>(this, boxX, 32.0f, 24.0f, 120.0f, Position.LEFT) {
@Override
public ControlTab<BreedingSystem> createTab(float x, float y, float w, float h, BreedingSystem value) {
return new ControlTabIcon<BreedingSystem>(this, x, y, w, h, value) {
@@ -142,7 +142,7 @@ public class WindowGeneBank extends WindowMachine {
tabBar.setValues(Binnie.Genetics.getActiveSystems());
tabBar.setValue(Binnie.Genetics.beeBreedingSystem);
boxX -= 8;
ControlTabBar<String> infoTabs = new ControlTabBar<String>(this, boxX + 8, 160.0f, 16.0f, 50.0f, Position.Left);
ControlTabBar<String> infoTabs = new ControlTabBar<String>(this, boxX + 8, 160.0f, 16.0f, 50.0f, Position.LEFT);
infoTabs.setValues(Arrays.asList("Stats", "Ranking"));
infoTabs.setValue("Info");
Panel panelProject = new Panel(this, boxX + 24, 160.0f, geneBoxWidth + 20, 50.0f, MinecraftGUI.PanelType.Black);
@@ -15,6 +15,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlotArray;
import binnie.core.craftgui.minecraft.control.ControlSlotCharge;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.util.I18N;
import binnie.extrabees.core.ExtraBeeTexture;
import binnie.genetics.Genetics;
import binnie.genetics.machine.genepool.Genepool;
@@ -36,7 +37,7 @@ public class WindowGenepool extends WindowMachine {
@Override
public void initialiseClient() {
setTitle("Genepool");
setTitle(getTitle());
int x = 16;
int y = 32;
new ControlLiquidTank(this, x, y).setTankID(1);
@@ -47,19 +48,19 @@ public class WindowGenepool extends WindowMachine {
x += 18;
new ControlSlot(this, x, y + 3 + 18).assign(0);
x += 18;
new ControlMachineProgress(this, x, y + 19, WindowGenepool.ProgressBase, WindowGenepool.Progress, Position.Left);
new ControlMachineProgress(this, x, y + 19, WindowGenepool.ProgressBase, WindowGenepool.Progress, Position.LEFT);
x += 130;
new ControlLiquidTank(this, x, y).setTankID(0);
new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
new ControlSlot(this, 121.0f, 82.0f).assign(7);
new ControlSlotCharge(this, 143, 82, 7).setColor(15722671);
new ControlLiquidTank(this, x, y).setTankID(Genepool.TANK_DNA);
new ControlEnergyBar(this, 21, 115, 16, 60, Position.BOTTOM);
new ControlSlot(this, 121.0f, 82.0f).assign(Genepool.SLOT_ENZYME);
new ControlSlotCharge(this, 143, 82, 7).setColor(0xefe8af);
new ControlErrorState(this, 181.0f, 83.0f);
new ControlPlayerInventory(this);
}
@Override
public String getTitle() {
return "Genepool";
return I18N.localise(Genetics.instance, "machine.labMachine.genepool");
}
@Override
@@ -69,6 +70,6 @@ public class WindowGenepool extends WindowMachine {
@Override
protected String getName() {
return "Genepool";
return getTitle();
}
}
@@ -44,7 +44,7 @@ public class WindowIncubator extends WindowMachine {
x += 20;
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon());
x += 18;
new ControlMachineProgress(this, x, y + 6, WindowIncubator.ProgressBase, WindowIncubator.Progress, Position.Left);
new ControlMachineProgress(this, x, y + 6, WindowIncubator.ProgressBase, WindowIncubator.Progress, Position.LEFT);
new ControlSlot(this, x + 11, y + 3 + 10).assign(3);
x += 40;
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon());
@@ -53,7 +53,7 @@ public class WindowIncubator extends WindowMachine {
x += 26;
new ControlLiquidTank(this, x, y).setTankID(1);
x += 34;
new ControlEnergyBar(this, x, y + 3, 16, 54, Position.Bottom);
new ControlEnergyBar(this, x, y + 3, 16, 54, Position.BOTTOM);
new ControlErrorState(this, 91.0f, 82.0f);
new ControlPlayerInventory(this);
}
@@ -43,8 +43,8 @@ public class WindowInoculator extends WindowMachine {
new ControlLiquidTank(this, x, y + 18 + 16).setTankID(0);
CraftGUIUtil.horizontalGrid(x, y, new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), new ControlSlot(this, 0.0f, 0.0f).assign(0), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_EXPENDED));
x += 18;
new ControlMachineProgress(this, x, y + 24, WindowInoculator.ProgressBase, WindowInoculator.Progress, Position.Left);
new ControlEnergyBar(this, 91, 118, 60, 16, Position.Left);
new ControlMachineProgress(this, x, y + 24, WindowInoculator.ProgressBase, WindowInoculator.Progress, Position.LEFT);
new ControlEnergyBar(this, 91, 118, 60, 16, Position.LEFT);
new ControlErrorState(this, 161.0f, 118.0f);
x += 142;
CraftGUIUtil.verticalGrid(x, y, TextJustification.MiddleLeft, 8.0f, new ControlSlotArray(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE), new ControlSlot(this, x, y + 18 + 8).assign(9), new ControlSlotArray(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.SLOT_FINISHED));
@@ -49,7 +49,7 @@ public class WindowIsolator extends WindowMachine {
new ControlSlot(this, x, y + 36 + 3).assign(0);
new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColor(15722671);
x += 18;
new ControlProgress(this, x, y + 3, WindowIsolator.ProgressBase, WindowIsolator.Progress, Position.Left);
new ControlProgress(this, x, y + 3, WindowIsolator.ProgressBase, WindowIsolator.Progress, Position.LEFT);
x += 142;
new ControlSlot(this, x, y + 3).assign(6);
new ControlSlot(this, x, y + 3 + 36).assign(1);
@@ -58,7 +58,7 @@ public class WindowIsolator extends WindowMachine {
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon());
x += 18;
new ControlSlotArray(this, x, y + 3, 2, 3).create(Isolator.SLOT_FINISHED);
new ControlEnergyBar(this, 260, 130, 16, 60, Position.Bottom);
new ControlEnergyBar(this, 260, 130, 16, 60, Position.BOTTOM);
new ControlErrorState(this, 153.0f, 81.0f);
new ControlPlayerInventory(this);
}
@@ -45,11 +45,11 @@ public class WindowPolymeriser extends WindowMachine {
new ControlSlotArray(this, x, y, 1, 4).create(Polymeriser.SLOT_SERUM_RESERVE);
new ControlIconDisplay(this, x + 18, y + 1, GUIIcon.ArrowRight.getIcon());
x += 34;
new ControlMachineProgress(this, x + 18, y - 6, WindowPolymeriser.ProgressBase, WindowPolymeriser.Progress, Position.Left);
new ControlMachineProgress(this, x + 18, y - 6, WindowPolymeriser.ProgressBase, WindowPolymeriser.Progress, Position.LEFT);
new ControlSlot(this, x, y).assign(0);
new ControlLiquidTank(this, x, y + 18 + 16, true).setTankID(0);
new ControlLiquidTank(this, x, y + 18 + 16 + 18 + 8, true).setTankID(1);
new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.Left);
new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.LEFT);
x += 40;
new ControlSlot(this, x + 30, y + 18 + 8).assign(1);
new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColor(16766976);
@@ -65,7 +65,7 @@ public class WindowSequencer extends WindowMachine {
x += 20;
new ControlSlotCharge(this, x, y, 0).setColor(16750848);
x += 32;
new ControlEnergyBar(this, x, y, 60, 16, Position.Left);
new ControlEnergyBar(this, x, y, 60, 16, Position.LEFT);
x += 92;
ControlErrorState errorState = new ControlErrorState(this, x, y + 1);
new ControlPlayerInventory(this);
@@ -42,7 +42,7 @@ public class WindowSplicer extends WindowMachine {
CraftGUIUtil.horizontalGrid(x, 62.0f, new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowRight.getIcon()), new ControlSlot(this, 0.0f, 0.0f).assign(0));
new ControlSlotArray(this, x + 12, 84, 2, 1).create(Splicer.SLOT_SERUM_EXPENDED);
new ControlIconDisplay(this, x + 12 + 36 + 4, 86.0f, GUIIcon.ArrowUpLeft.getIcon());
new ControlEnergyBar(this, 196, 64, 60, 16, Position.Left);
new ControlEnergyBar(this, 196, 64, 60, 16, Position.LEFT);
new ControlErrorState(this, 218.0f, 86.0f);
CraftGUIUtil.verticalGrid((w() - 72.0f) / 2.0f, 32.0f, TextJustification.MiddleCenter, 4.0f, new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowDown.getIcon()), new ControlSlot(this, 0.0f, 0.0f).assign(9), new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowDown.getIcon()), new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_FINISHED));
new ControlPlayerInventory(this);
@@ -223,7 +223,7 @@ public class WindowAnalyst extends Window {
}
};
if (!isDatabase) {
slideUpInv = new ControlSlide(this, (getSize().x() - 244.0f) / 2.0f, getSize().y() - 80.0f + 1.0f, 244.0f, 80.0f, Position.Bottom);
slideUpInv = new ControlSlide(this, (getSize().x() - 244.0f) / 2.0f, getSize().y() - 80.0f + 1.0f, 244.0f, 80.0f, Position.BOTTOM);
new ControlPlayerInventory(slideUpInv, true);
slideUpInv.setSlide(false);
}
@@ -1,6 +1,6 @@
package binnie.genetics.item;
import binnie.genetics.CreativeTabGenetics;
import binnie.genetics.GeneticsCreativeTab;
import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsGUI;
import cpw.mods.fml.relauncher.Side;
@@ -13,7 +13,7 @@ import net.minecraft.world.World;
public class ItemAnalyst extends Item {
public ItemAnalyst() {
setCreativeTab(CreativeTabGenetics.instance);
setCreativeTab(GeneticsCreativeTab.instance);
setUnlocalizedName("analyst");
setMaxStackSize(1);
}
@@ -1,6 +1,6 @@
package binnie.genetics.item;
import binnie.genetics.CreativeTabGenetics;
import binnie.genetics.GeneticsCreativeTab;
import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsGUI;
import cpw.mods.fml.relauncher.Side;
@@ -19,7 +19,7 @@ public class ItemDatabase extends Item {
protected IIcon iconMaster;
public ItemDatabase() {
setCreativeTab(CreativeTabGenetics.instance);
setCreativeTab(GeneticsCreativeTab.instance);
setUnlocalizedName("database");
setMaxStackSize(1);
}
@@ -1,6 +1,6 @@
package binnie.genetics.item;
import binnie.genetics.CreativeTabGenetics;
import binnie.genetics.GeneticsCreativeTab;
import binnie.genetics.Genetics;
import binnie.genetics.genetics.IGeneItem;
import cpw.mods.fml.relauncher.Side;
@@ -22,7 +22,7 @@ public abstract class ItemGene extends Item {
setMaxStackSize(1);
setMaxDamage(16);
setUnlocalizedName(unlocName);
setCreativeTab(CreativeTabGenetics.instance);
setCreativeTab(GeneticsCreativeTab.instance);
}
@Override
@@ -1,6 +1,6 @@
package binnie.genetics.item;
import binnie.genetics.CreativeTabGenetics;
import binnie.genetics.GeneticsCreativeTab;
import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsGUI;
import cpw.mods.fml.relauncher.Side;
@@ -13,7 +13,7 @@ import net.minecraft.world.World;
public class ItemMasterRegistry extends Item {
public ItemMasterRegistry() {
setCreativeTab(CreativeTabGenetics.instance);
setCreativeTab(GeneticsCreativeTab.instance);
setUnlocalizedName("masterRegistry");
setMaxStackSize(1);
}
@@ -1,6 +1,6 @@
package binnie.genetics.item;
import binnie.genetics.CreativeTabGenetics;
import binnie.genetics.GeneticsCreativeTab;
import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsGUI;
import cpw.mods.fml.relauncher.Side;
@@ -13,7 +13,7 @@ import net.minecraft.world.World;
public class ItemRegistry extends Item {
public ItemRegistry() {
setCreativeTab(CreativeTabGenetics.instance);
setCreativeTab(GeneticsCreativeTab.instance);
setUnlocalizedName("registry");
setMaxStackSize(1);
}
@@ -2,7 +2,7 @@ package binnie.genetics.item;
import binnie.Binnie;
import binnie.core.genetics.Gene;
import binnie.genetics.CreativeTabGenetics;
import binnie.genetics.GeneticsCreativeTab;
import binnie.genetics.Genetics;
import binnie.genetics.api.IGene;
import binnie.genetics.api.IItemAnalysable;
@@ -27,7 +27,7 @@ public class ItemSequence extends Item implements IItemAnalysable, IItemChargabl
setMaxStackSize(1);
setMaxDamage(5);
setUnlocalizedName("sequence");
setCreativeTab(CreativeTabGenetics.instance);
setCreativeTab(GeneticsCreativeTab.instance);
}
public static ItemStack create(IGene gene) {
@@ -9,7 +9,7 @@ import binnie.core.liquid.ItemFluidContainer;
import binnie.core.resource.BinnieIcon;
import binnie.extrabees.ExtraBees;
import binnie.extratrees.ExtraTrees;
import binnie.genetics.CreativeTabGenetics;
import binnie.genetics.GeneticsCreativeTab;
import binnie.genetics.Genetics;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.recipes.RecipeManagers;
@@ -42,7 +42,7 @@ public class ModuleItem implements IInitializable {
Genetics.itemSerum = new ItemSerum();
Genetics.itemSerumArray = new ItemSerumArray();
Genetics.itemSequencer = new ItemSequence();
Genetics.itemGenetics = Binnie.Item.registerMiscItems(GeneticsItems.values(), CreativeTabGenetics.instance);
Genetics.itemGenetics = Binnie.Item.registerMiscItems(GeneticsItems.values(), GeneticsCreativeTab.instance);
Genetics.database = new ItemDatabase();
Genetics.analyst = new ItemAnalyst();
Genetics.registry = new ItemRegistry();
@@ -5,7 +5,7 @@ import binnie.core.IInitializable;
import binnie.core.Mods;
import binnie.core.machines.MachineGroup;
import binnie.core.machines.inventory.ValidatorIcon;
import binnie.genetics.CreativeTabGenetics;
import binnie.genetics.GeneticsCreativeTab;
import binnie.genetics.Genetics;
import binnie.genetics.item.GeneticsItems;
import binnie.genetics.machine.acclimatiser.Acclimatiser;
@@ -28,13 +28,13 @@ public class ModuleMachine implements IInitializable {
@Override
public void preInit() {
Genetics.packageGenetic = new MachineGroup(Genetics.instance, "machine", "machine", GeneticMachine.values());
Genetics.packageGenetic.setCreativeTab(CreativeTabGenetics.instance);
Genetics.packageGenetic.setCreativeTab(GeneticsCreativeTab.instance);
Genetics.packageLabMachine = new MachineGroup(Genetics.instance, "labMachine", "labMachine", LaboratoryMachine.values());
Genetics.packageLabMachine.setCreativeTab(CreativeTabGenetics.instance);
Genetics.packageLabMachine.setCreativeTab(GeneticsCreativeTab.instance);
Genetics.packageAdvGenetic = new MachineGroup(Genetics.instance, "advMachine", "advMachine", AdvGeneticMachine.values());
Genetics.packageAdvGenetic.setCreativeTab(CreativeTabGenetics.instance);
Genetics.packageAdvGenetic.setCreativeTab(GeneticsCreativeTab.instance);
}
@Override
@@ -25,6 +25,7 @@ public class Acclimatiser {
public static final int[] SLOT_ACCLIMATISER = new int[]{5, 6, 7};
public static final int[] SLOT_DONE = new int[]{8, 9, 10, 11};
public static final int SLOT_TARGET = 4;
public static final float ENERGY_PER_TICK = 2.0f;
protected static Map<ItemStack, Float> temperatureItems = new HashMap<>();
protected static Map<ItemStack, Float> humidityItems = new HashMap<>();
@@ -12,7 +12,7 @@ import java.util.List;
public class AcclimatiserComponentLogic extends ComponentProcessIndefinate {
public AcclimatiserComponentLogic(IMachine machine) {
super(machine, 2.0f);
super(machine, Acclimatiser.ENERGY_PER_TICK);
}
@Override
@@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack;
import java.util.Random;
class ToleranceSystem {
public class ToleranceSystem {
public String uid;
public IChromosomeType chromosomeOrdinal;
public ToleranceType type;
@@ -30,7 +30,8 @@ class ToleranceSystem {
IAlleleTolerance tolAllele = (IAlleleTolerance) genome.getActiveAllele(chromosomeOrdinal);
Tolerance tol = Tolerance.get(tolAllele.getValue());
float effect = type.getEffect(acclim);
return (effect > 0.0f && tol.getBounds()[1] < 5) || (effect < 0.0f && tol.getBounds()[0] > -5);
return (effect > 0.0f && tol.getBounds()[1] < 5)
|| (effect < 0.0f && tol.getBounds()[0] > -5);
}
public ItemStack alter(ItemStack stack, ItemStack acc) {
@@ -13,6 +13,9 @@ public class Analyser {
public static final int[] SLOT_FINISHED = new int[]{7, 8, 9, 10, 11, 12};
public static final int SLOT_TARGET = 6;
public static final int SLOT_DYE = 13;
public static final int RF_COST = 9000;
public static final int TIME_PERIOD = 300;
public static final float DYE_PER_TICK = 0.002f;
public static boolean isAnalysable(ItemStack stack) {
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
@@ -4,34 +4,47 @@ import binnie.core.machines.Machine;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import binnie.core.util.I18N;
import binnie.genetics.Genetics;
import net.minecraft.item.ItemStack;
public class AnalyserComponentLogic extends ComponentProcessSetCost implements IProcess {
private static final float DYE_PER_TICK = 0.002f;
public AnalyserComponentLogic(Machine machine) {
super(machine, 9000, 300);
super(machine, Analyser.RF_COST, Analyser.TIME_PERIOD);
}
@Override
public ErrorState canWork() {
if (getUtil().isSlotEmpty(Analyser.SLOT_TARGET)) {
return new ErrorState.NoItem("No item to analyse", Analyser.SLOT_TARGET);
return new ErrorState.NoItem(
I18N.localise(Genetics.instance, "machine.analyser.error.noItem"),
Analyser.SLOT_TARGET
);
}
boolean analysed = Analyser.isAnalysed(getUtil().getStack(Analyser.SLOT_TARGET));
if (analysed) {
return new ErrorState.InvalidItem("Already Analysed", "Item has already been analysed", Analyser.SLOT_TARGET);
if (!analysed) {
return super.canWork();
}
return super.canWork();
return new ErrorState.InvalidItem(
I18N.localise(Genetics.instance, "machine.analyser.error.alreadyAnalysed.title"),
I18N.localise(Genetics.instance, "machine.analyser.error.alreadyAnalysed"),
Analyser.SLOT_TARGET
);
}
@Override
public ErrorState canProgress() {
if (getUtil().getSlotCharge(Analyser.SLOT_DYE) == 0.0f) {
return new ErrorState.Item("Insufficient Dye", "Not enough DNA dye to analyse", new int[]{Analyser.SLOT_DYE});
if (getUtil().getSlotCharge(Analyser.SLOT_DYE) != 0.0f) {
return super.canProgress();
}
return super.canProgress();
return new ErrorState.Item(
I18N.localise(Genetics.instance, "machine.analyser.error.insufficientDye.title"),
I18N.localise(Genetics.instance, "machine.analyser.error.insufficientDye"),
new int[]{Analyser.SLOT_DYE}
);
}
@Override
@@ -44,6 +57,6 @@ public class AnalyserComponentLogic extends ComponentProcessSetCost implements I
@Override
protected void onTickTask() {
getUtil().useCharge(Analyser.SLOT_DYE, DYE_PER_TICK);
getUtil().useCharge(Analyser.SLOT_DYE, Analyser.DYE_PER_TICK);
}
}
@@ -1,6 +1,8 @@
package binnie.genetics.machine.analyser;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.util.I18N;
import binnie.genetics.Genetics;
import binnie.genetics.item.GeneticsItems;
import binnie.genetics.machine.ModuleMachine;
import net.minecraft.item.ItemStack;
@@ -17,6 +19,6 @@ public class DyeSlotValidator extends SlotValidator {
@Override
public String getTooltip() {
return "DNA Dye";
return I18N.localise(Genetics.instance, "machine.analyser.dnaDye");
}
}
@@ -1,6 +1,8 @@
package binnie.genetics.machine.analyser;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.util.I18N;
import binnie.genetics.Genetics;
import net.minecraft.item.ItemStack;
public class UnanalysedSlotValidator extends SlotValidator {
@@ -9,13 +11,13 @@ public class UnanalysedSlotValidator extends SlotValidator {
}
@Override
public boolean isValid(ItemStack itemStack) {
return Analyser.isAnalysable(itemStack)
&& !Analyser.isAnalysed(itemStack);
public boolean isValid(ItemStack stack) {
return Analyser.isAnalysable(stack)
&& !Analyser.isAnalysed(stack);
}
@Override
public String getTooltip() {
return "Unanalysed Item";
return I18N.localise(Genetics.instance, "machine.analyser.unanalysedItem");
}
}
@@ -1,12 +1,13 @@
package binnie.genetics.machine.genepool;
import binnie.core.machines.inventory.TankValidator;
import binnie.core.util.I18N;
import net.minecraftforge.fluids.FluidStack;
class EthanolTankValidator extends TankValidator {
public class EthanolTankValidator extends TankValidator {
@Override
public String getTooltip() {
return "Ethanol";
return I18N.localise("fluid.bioethanol");
}
@Override
@@ -6,4 +6,8 @@ public class Genepool {
public static final int TANK_ETHANOL = 1;
public static final int SLOT_ENZYME = 7;
public static final int[] SLOT_RESERVE = new int[]{1, 2, 3, 4, 5, 6};
public static final int RF_COST = 8000;
public static final int TIME_PERIOD = 400;
public static final float ENZYME_PER_PROCESS = 0.25f;
public static final float ETHANOL_PER_PROCESS = 50.0f;
}
@@ -6,27 +6,28 @@ import binnie.core.machines.inventory.IChargedSlots;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import binnie.core.util.I18N;
import binnie.genetics.Genetics;
import binnie.genetics.item.GeneticLiquid;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.item.ItemStack;
public class GenepoolComponentLogic extends ComponentProcessSetCost implements IProcess {
float enzymePerProcess;
float ethanolPerProcess;
private float ethanolDrain;
public GenepoolComponentLogic(Machine machine) {
super(machine, 8000, 400);
enzymePerProcess = 0.25f;
ethanolPerProcess = 50.0f;
super(machine, Genepool.RF_COST, Genepool.TIME_PERIOD);
ethanolDrain = 0.0f;
}
@Override
public ErrorState canWork() {
if (getUtil().isSlotEmpty(0)) {
return new ErrorState.NoItem("No Individual", Genepool.SLOT_BEE);
return new ErrorState.NoItem(
I18N.localise(Genetics.instance, "machine.genepool.error.noIndividual"),
Genepool.SLOT_BEE
);
}
return super.canWork();
}
@@ -34,13 +35,22 @@ public class GenepoolComponentLogic extends ComponentProcessSetCost implements I
@Override
public ErrorState canProgress() {
if (!getUtil().spaceInTank(Genepool.TANK_DNA, getDNAAmount(getUtil().getStack(Genepool.TANK_DNA)))) {
return new ErrorState.NoSpace("Not enough room in Tank", new int[]{Genepool.TANK_DNA});
return new ErrorState.NoSpace(
I18N.localise(Genetics.instance, "machine.genepool.error.noRoom"),
Genepool.TANK_DNA
);
}
if (!getUtil().liquidInTank(1, 1)) {
return new ErrorState.InsufficientLiquid("Not enough Ethanol", Genepool.TANK_ETHANOL);
return new ErrorState.InsufficientLiquid(
I18N.localise(Genetics.instance, "machine.genepool.error.noEthanol"),
Genepool.TANK_ETHANOL
);
}
if (getUtil().getSlotCharge(Genepool.SLOT_ENZYME) == 0.0f) {
return new ErrorState.NoItem("Insufficient Enzyme", Genepool.SLOT_ENZYME);
return new ErrorState.NoItem(
I18N.localise(Genetics.instance, "machine.genepool.error.insufficientEnzyme"),
Genepool.SLOT_ENZYME
);
}
return super.canProgress();
}
@@ -60,6 +70,7 @@ public class GenepoolComponentLogic extends ComponentProcessSetCost implements I
|| Binnie.Genetics.getBeeRoot().isDrone(stack)) {
return 10;
}
if (Binnie.Genetics.getBeeRoot().isMated(stack)) {
return 50;
}
@@ -73,6 +84,8 @@ public class GenepoolComponentLogic extends ComponentProcessSetCost implements I
getUtil().drainTank(Genepool.TANK_ETHANOL, 1);
ethanolDrain--;
}
getMachine().getInterface(IChargedSlots.class).alterCharge(Genepool.SLOT_ENZYME, -enzymePerProcess * getProgressPerTick() / 100.0f);
getMachine().getInterface(IChargedSlots.class)
.alterCharge(Genepool.SLOT_ENZYME, -Genepool.ENZYME_PER_PROCESS * getProgressPerTick() / 100.0f);
}
}
@@ -4,7 +4,7 @@ import binnie.core.machines.inventory.Validator;
import binnie.genetics.item.GeneticLiquid;
import net.minecraftforge.fluids.FluidStack;
class BacteriaVectorValidator extends Validator<FluidStack> {
public class BacteriaVectorValidator extends Validator<FluidStack> {
@Override
public boolean isValid(FluidStack object) {
return GeneticLiquid.BacteriaVector.get(1).isFluidEqual(object);
@@ -5,7 +5,7 @@ import binnie.genetics.api.IItemSerum;
import binnie.genetics.machine.ModuleMachine;
import net.minecraft.item.ItemStack;
class SerumSlotValidator extends SlotValidator {
public class SerumSlotValidator extends SlotValidator {
public SerumSlotValidator() {
super(ModuleMachine.IconSerum);
}
@@ -3,7 +3,7 @@ package binnie.genetics.machine.isolator;
import binnie.core.machines.inventory.TankValidator;
import net.minecraftforge.fluids.FluidStack;
class EthanolTankValidator extends TankValidator {
public class EthanolTankValidator extends TankValidator {
@Override
public String getTooltip() {
return "Ethanol";
@@ -54,7 +54,7 @@ public class SequencerComponentLogic extends ComponentProcess implements IProces
ItemStack stack = getUtil().getStack(Sequencer.SLOT_DONE_INDEX);
if (stack != null && stack.stackSize >= 64) {
return new ErrorState.NoSpace("No space for empty sequences", new int[]{Sequencer.SLOT_DONE_INDEX});
return new ErrorState.NoSpace("No space for empty sequences", Sequencer.SLOT_DONE_INDEX);
}
return super.canProgress();
}