diff options
Diffstat (limited to 'src/Java/binnie/craftgui/genetics/machine')
19 files changed, 1628 insertions, 0 deletions
diff --git a/src/Java/binnie/craftgui/genetics/machine/ControlGene.java b/src/Java/binnie/craftgui/genetics/machine/ControlGene.java new file mode 100644 index 0000000000..a5c830154e --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/ControlGene.java @@ -0,0 +1,101 @@ +package binnie.craftgui.genetics.machine; + +import binnie.Binnie; +import binnie.core.genetics.BreedingSystem; +import binnie.core.genetics.ManagerGenetics; +import binnie.core.resource.BinnieIcon; +import binnie.craftgui.controls.core.Control; +import binnie.craftgui.controls.core.IControlValue; +import binnie.craftgui.core.Attribute; +import binnie.craftgui.core.CraftGUI; +import binnie.craftgui.core.ITooltip; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.Tooltip; +import binnie.craftgui.core.geometry.IArea; +import binnie.craftgui.core.geometry.IPoint; +import binnie.craftgui.core.renderer.Renderer; +import binnie.craftgui.events.EventMouse.Down; +import binnie.craftgui.events.EventMouse.Down.Handler; +import binnie.craftgui.minecraft.Window; +import binnie.genetics.api.IGene; +import binnie.genetics.core.GeneticsTexture; +import binnie.genetics.genetics.Engineering; +import forestry.api.genetics.IChromosomeType; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class ControlGene + extends Control + implements IControlValue<IGene>, ITooltip +{ + IGene gene; + + public void getTooltip(Tooltip tooltip) + { + String cName = Binnie.Genetics.getSystem(this.gene.getSpeciesRoot()).getChromosomeName(this.gene.getChromosome()); + tooltip.add(cName + ": " + this.gene.getName()); + if ((isMouseOver()) && (canFill(Window.get(this).getHeldItemStack()))) + { + tooltip.add("Left click to assign gene"); + IGene existingGene = Engineering.getGene(Window.get(this).getHeldItemStack(), this.gene.getChromosome().ordinal()); + if (existingGene == null) { + return; + } + String dName = Binnie.Genetics.getSystem(this.gene.getSpeciesRoot()).getChromosomeName(this.gene.getChromosome()); + tooltip.add("Will replace " + dName + ": " + existingGene.getName()); + } + } + + private boolean canFill(ItemStack stack) + { + return (stack != null) && (stack.stackSize == 1) && (Engineering.isGeneAcceptor(stack)) && (Engineering.canAcceptGene(stack, getValue())); + } + + protected ControlGene(IWidget parent, float x, float y) + { + super(parent, x, y, 16.0F, 16.0F); + addAttribute(Attribute.MouseOver); + + addSelfEventHandler(new EventMouse.Down.Handler() + { + public void onEvent(EventMouse.Down event) + { + if (ControlGene.this.canFill(Window.get(ControlGene.this.getWidget()).getHeldItemStack())) + { + NBTTagCompound action = new NBTTagCompound(); + + NBTTagCompound geneNBT = new NBTTagCompound(); + ControlGene.this.getValue().writeToNBT(geneNBT); + + action.setTag("gene", geneNBT); + + Window.get(ControlGene.this.getWidget()).sendClientAction("gene-select", action); + } + } + }); + } + + public IGene getValue() + { + return this.gene; + } + + public void setValue(IGene value) + { + this.gene = value; + } + + public void onRenderForeground() {} + + public void onRenderBackground() + { + if ((isMouseOver()) && (canFill(Window.get(this).getHeldItemStack()))) + { + CraftGUI.Render.solid(getArea(), -1); + CraftGUI.Render.solid(getArea().inset(1), -12303292); + } + CraftGUI.Render.colour(-1); + + CraftGUI.Render.iconItem(IPoint.ZERO, GeneticsTexture.dnaIcon.getIcon()); + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/ControlGeneScroll.java b/src/Java/binnie/craftgui/genetics/machine/ControlGeneScroll.java new file mode 100644 index 0000000000..a779933050 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/ControlGeneScroll.java @@ -0,0 +1,97 @@ +package binnie.craftgui.genetics.machine; + +import binnie.Binnie; +import binnie.core.genetics.BreedingSystem; +import binnie.core.genetics.Gene; +import binnie.core.genetics.ManagerGenetics; +import binnie.craftgui.controls.ControlText; +import binnie.craftgui.controls.core.Control; +import binnie.craftgui.controls.core.IControlValue; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.geometry.IPoint; +import binnie.craftgui.minecraft.Window; +import binnie.genetics.genetics.GeneTracker; +import forestry.api.genetics.IAllele; +import forestry.api.genetics.IChromosomeType; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +public class ControlGeneScroll + extends Control + implements IControlValue<BreedingSystem> +{ + protected ControlGeneScroll(IWidget parent, float x, float y, float w, float h) + { + super(parent, x, y, w, h); + } + + private String filter = ""; + private BreedingSystem system = null; + + public void setFilter(String filter) + { + this.filter = filter.toLowerCase(); + refresh(); + } + + public void setGenes(BreedingSystem system) + { + this.system = system; + refresh(); + } + + public void refresh() + { + deleteAllChildren(); + + GeneTracker tracker = GeneTracker.getTracker(Window.get(this).getWorld(), Window.get(this).getUsername()); + + Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(this.system.getSpeciesRoot()); + + int x = 0; + int y = 0; + + boolean isNEI = ((WindowGeneBank)Window.get(this)).isNei; + for (Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet()) + { + List<IAllele> discovered = new ArrayList(); + for (IAllele allele : (List)entry.getValue()) + { + Gene gene = new Gene(allele, (IChromosomeType)entry.getKey(), this.system.getSpeciesRoot()); + if (((isNEI) || (tracker.isSequenced(new Gene(allele, (IChromosomeType)entry.getKey(), this.system.getSpeciesRoot())))) && (gene.getName().toLowerCase().contains(this.filter))) { + discovered.add(allele); + } + } + if (discovered.size() != 0) + { + x = 0; + new ControlText(this, new IPoint(x, y), this.system.getChromosomeName((IChromosomeType)entry.getKey())); + y += 12; + for (IAllele allele : discovered) + { + if (x + 18 > getSize().x()) + { + y += 20; + x = 0; + } + new ControlGene(this, x, y).setValue(new Gene(allele, (IChromosomeType)entry.getKey(), this.system.getSpeciesRoot())); + x += 18; + } + y += 24; + } + } + setSize(new IPoint(getSize().x(), y)); + } + + public void setValue(BreedingSystem system) + { + setGenes(system); + } + + public BreedingSystem getValue() + { + return this.system; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/ControlProcessTemporary.java b/src/Java/binnie/craftgui/genetics/machine/ControlProcessTemporary.java new file mode 100644 index 0000000000..43e32dc9ad --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/ControlProcessTemporary.java @@ -0,0 +1,27 @@ +package binnie.craftgui.genetics.machine; + +import binnie.craftgui.core.CraftGUI; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.geometry.IArea; +import binnie.craftgui.core.geometry.IPoint; +import binnie.craftgui.core.renderer.Renderer; +import binnie.craftgui.minecraft.control.ControlMachineProgress; + +public class ControlProcessTemporary + extends ControlMachineProgress +{ + public ControlProcessTemporary(IWidget parent, int x, int y, int width, int height) + { + super(parent, x, y, null, null, null); + setSize(new IPoint(width, height)); + } + + public void onRenderBackground() + { + CraftGUI.Render.solid(getArea(), -4868683); + + float w = getSize().y() * this.progress / 100.0F; + + CraftGUI.Render.solid(new IArea(getArea().x(), getArea().y(), w, getArea().h()), -65536); + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/ControlSequencerProgress.java b/src/Java/binnie/craftgui/genetics/machine/ControlSequencerProgress.java new file mode 100644 index 0000000000..1a80f71676 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/ControlSequencerProgress.java @@ -0,0 +1,64 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.machines.IMachine; +import binnie.core.machines.Machine; +import binnie.core.machines.MachineUtil; +import binnie.craftgui.controls.ControlText; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.geometry.IArea; +import binnie.craftgui.core.geometry.TextJustification; +import binnie.craftgui.minecraft.MinecraftGUI.PanelType; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlProgressBase; +import binnie.craftgui.window.Panel; +import java.util.Random; +import net.minecraft.item.ItemStack; + +public class ControlSequencerProgress + extends ControlProgressBase +{ + ControlText textControl; + + public ControlSequencerProgress(IWidget parent, int x, int y) + { + super(parent, x, y, 100.0F, 52.0F); + + Panel panel = new Panel(this, 0.0F, 0.0F, 100.0F, 52.0F, MinecraftGUI.PanelType.Gray); + + this.textControl = new ControlText(panel, new IArea(4.0F, 4.0F, 92.0F, 44.0F), "", TextJustification.MiddleCenter); + } + + public void onUpdateClient() + { + super.onUpdateClient(); + + ItemStack stack = Machine.getMachine(Window.get(this).getInventory()).getMachineUtil().getStack(5); + if (stack == null) + { + this.textControl.setValue(""); + } + else + { + Random rand = new Random(stack.getDisplayName().length()); + + String text = ""; + String[] codes = { "A", "T", "G", "C" }; + String[] colors = { "a", "d", "b", "c" }; + for (int i = 0; i < 65; i++) + { + int k = rand.nextInt(4); + String code = codes[k]; + if (rand.nextFloat() < this.progress) + { + String col = "§" + colors[k]; + text = text + "§r" + col + "§l" + code; + } + else + { + text = text + "§r§7§k§l" + code; + } + } + this.textControl.setValue(text); + } + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/ControlSplicerProgress.java b/src/Java/binnie/craftgui/genetics/machine/ControlSplicerProgress.java new file mode 100644 index 0000000000..7afa16f31f --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/ControlSplicerProgress.java @@ -0,0 +1,60 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.machines.power.ProcessInfo; +import binnie.craftgui.core.CraftGUI; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.geometry.IArea; +import binnie.craftgui.core.renderer.Renderer; +import binnie.craftgui.minecraft.control.ControlProgressBase; + +public class ControlSplicerProgress + extends ControlProgressBase +{ + float strength = 0.0F; + + public ControlSplicerProgress(IWidget parent, float x, float y, float w, float h) + { + super(parent, x, y, w, h); + this.strength = 0.0F; + } + + public void onRenderBackground() + { + float progress = getProcess().getCurrentProgress() / 100.0F; + + float n = getProcess().getProcessTime() / 12.0F; + float spacing = 10.0F; + float range = w(); + float h = 8.0F; + + float ooy = -((n - 1.0F) * spacing) - range / 2.0F; + float ddy = (n - 1.0F) * spacing + range; + float oy = ooy + ddy * progress; + for (int i = 0; i < n; i++) + { + int seed = 432523; + int[] colours = { 10027008, 30464, 255, 10057472 }; + int c1 = colours[((int)Math.abs(13.0D * Math.sin(i) + 48.0D * Math.cos(i) + 25.0D * Math.sin(7 * i)) % 4)]; + int c2 = colours[((int)Math.abs(23.0D * Math.sin(i) + 28.0D * Math.cos(i) + 15.0D * Math.sin(7 * i)) % 4)]; + int c3 = colours[((int)Math.abs(43.0D * Math.sin(i) + 38.0D * Math.cos(i) + 55.0D * Math.sin(7 * i)) % 4)]; + int c4 = colours[((int)Math.abs(3.0D * Math.sin(i) + 18.0D * Math.cos(i) + 35.0D * Math.sin(7 * i)) % 4)]; + + float y = oy + i * spacing; + if ((y > -range / 2.0F) && (y < range / 2.0F)) + { + float percentView = (float)Math.sqrt(1.0F - Math.abs(2.0F * y / range)); + float offMovement = (h() - 2.0F * h) / 2.0F; + int alpha = 16777216 * (int)(255.0F * percentView); + c1 += alpha; + c2 += alpha; + c3 += alpha; + c4 += alpha; + CraftGUI.Render.solidAlpha(new IArea(w() / 2.0F + y, offMovement * percentView, 4.0F, h / 2.0F), c1); + CraftGUI.Render.solidAlpha(new IArea(w() / 2.0F + y, offMovement * percentView + 4.0F, 4.0F, h / 2.0F), y < 0.0F ? c2 : c3); + + CraftGUI.Render.solidAlpha(new IArea(w() / 2.0F + y, h() - offMovement * percentView - 8.0F, 4.0F, h / 2.0F), y < 0.0F ? c3 : c2); + CraftGUI.Render.solidAlpha(new IArea(w() / 2.0F + y, h() - offMovement * percentView - 4.0F, 4.0F, h / 2.0F), c4); + } + } + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowAcclimatiser.java b/src/Java/binnie/craftgui/genetics/machine/WindowAcclimatiser.java new file mode 100644 index 0000000000..8ed95dd0ef --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowAcclimatiser.java @@ -0,0 +1,80 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.core.geometry.Position; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlEnergyBar; +import binnie.craftgui.minecraft.control.ControlErrorState; +import binnie.craftgui.minecraft.control.ControlPlayerInventory; +import binnie.craftgui.minecraft.control.ControlSlot; +import binnie.craftgui.minecraft.control.ControlSlotArray; +import binnie.craftgui.resource.Texture; +import binnie.craftgui.resource.minecraft.StandardTexture; +import binnie.extrabees.core.ExtraBeeTexture; +import binnie.genetics.Genetics; +import binnie.genetics.machine.Acclimatiser; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowAcclimatiser + extends WindowMachine +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowAcclimatiser(player, inventory, side); + } + + public WindowAcclimatiser(EntityPlayer player, IInventory inventory, Side side) + { + super(280, 198, player, inventory, side); + } + + static Texture ProgressBase = new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture()); + static Texture Progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture()); + public static final int[] slotReserve = { 0, 1, 2, 3 }; + public static final int slotTarget = 4; + public static final int[] slotAcclimatiser = { 5, 6, 7 }; + public static final int[] slotDone = { 8, 9, 10, 11 }; + + public void initialiseClient() + { + setTitle("Acclimatiser"); + + int x = 16; + int y = 32; + + new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.slotReserve); + + x += 54; + + new ControlSlot(this, x + 18, y).assign(4); + new ControlSlotArray(this, x, y + 18 + 18, 3, 1).create(Acclimatiser.slotAcclimatiser); + + x += 72; + + new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.slotDone); + + + new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom); + + new ControlErrorState(this, 181.0F, 83.0F); + + new ControlPlayerInventory(this); + } + + public String getTitle() + { + return "Acclimatiser"; + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "Acclimatiser"; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowAnalyser.java b/src/Java/binnie/craftgui/genetics/machine/WindowAnalyser.java new file mode 100644 index 0000000000..c1a2ac5305 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowAnalyser.java @@ -0,0 +1,110 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.core.geometry.Position; +import binnie.craftgui.minecraft.GUIIcon; +import binnie.craftgui.minecraft.MinecraftGUI.PanelType; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlEnergyBar; +import binnie.craftgui.minecraft.control.ControlErrorState; +import binnie.craftgui.minecraft.control.ControlIconDisplay; +import binnie.craftgui.minecraft.control.ControlPlayerInventory; +import binnie.craftgui.minecraft.control.ControlProgress; +import binnie.craftgui.minecraft.control.ControlSlot; +import binnie.craftgui.minecraft.control.ControlSlotArray; +import binnie.craftgui.minecraft.control.ControlSlotCharge; +import binnie.craftgui.resource.Texture; +import binnie.craftgui.resource.minecraft.StandardTexture; +import binnie.craftgui.window.Panel; +import binnie.extrabees.core.ExtraBeeTexture; +import binnie.genetics.Genetics; +import binnie.genetics.core.GeneticsTexture; +import binnie.genetics.machine.Analyser; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowAnalyser + extends WindowMachine +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowAnalyser(player, inventory, side); + } + + static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, ExtraBeeTexture.GUIProgress.getTexture()); + 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); + } + + public void initialiseClient() + { + ProgressBase = new StandardTexture(0, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture()); + 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.slotReserve); + + + x += 28; + + new ControlSlot(this, x, y + 54 + 8).assign(13); + new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColour(10040319); + 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, ProgressBase, Progress, Position.Left); + + new ControlSlot(this, x + 38 - 9, y + 25 - 9).assign(6); + + new ControlIconDisplay(this, x + 76 + 2, y + 18, GUIIcon.ArrowRight.getIcon()); + + + x += 96; + + + + new ControlSlotArray(this, x, y, 2, 3).create(Analyser.slotFinished); + + + x += 52; + + setTitle("Analyser"); + + + new ControlPlayerInventory(this); + } + + public String getTitle() + { + return "Analyser"; + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "Analyser"; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowGeneBank.java b/src/Java/binnie/craftgui/genetics/machine/WindowGeneBank.java new file mode 100644 index 0000000000..e13bca4ce5 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowGeneBank.java @@ -0,0 +1,256 @@ +package binnie.craftgui.genetics.machine; + +import binnie.Binnie; +import binnie.core.AbstractMod; +import binnie.core.genetics.BreedingSystem; +import binnie.core.genetics.Gene; +import binnie.core.genetics.ManagerGenetics; +import binnie.craftgui.controls.ControlText; +import binnie.craftgui.controls.ControlTextEdit; +import binnie.craftgui.controls.scroll.ControlScrollableContent; +import binnie.craftgui.controls.tab.ControlTab; +import binnie.craftgui.controls.tab.ControlTabBar; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.Tooltip; +import binnie.craftgui.core.geometry.IPoint; +import binnie.craftgui.core.geometry.Position; +import binnie.craftgui.events.EventHandler.Origin; +import binnie.craftgui.events.EventTextEdit; +import binnie.craftgui.events.EventTextEdit.Handler; +import binnie.craftgui.events.EventValueChanged; +import binnie.craftgui.events.EventValueChanged.Handler; +import binnie.craftgui.minecraft.MinecraftGUI.PanelType; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlPlayerInventory; +import binnie.craftgui.minecraft.control.ControlTabIcon; +import binnie.craftgui.window.Panel; +import binnie.genetics.Genetics; +import binnie.genetics.genetics.Engineering; +import binnie.genetics.genetics.GeneTracker; +import cpw.mods.fml.relauncher.Side; +import forestry.api.genetics.IAllele; +import forestry.api.genetics.IChromosomeType; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IIcon; + +public class WindowGeneBank + extends WindowMachine +{ + public static IIcon[] iconsDNA; + public boolean isNei; + ControlGeneScroll genes; + + public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound action) + { + super.recieveGuiNBT(side, player, name, action); + if ((side == Side.SERVER) && (name.equals("gene-select"))) + { + Gene gene = new Gene(action.getCompoundTag("gene")); + if ((gene != null) && (!gene.isCorrupted())) + { + ItemStack held = getHeldItemStack(); + + ItemStack converted = Engineering.addGene(held, gene); + + getPlayer().inventory.setItemStack(converted); + + getPlayer().inventory.markDirty(); + if ((getPlayer() instanceof EntityPlayerMP)) { + ((EntityPlayerMP)getPlayer()).sendContainerToPlayer(player.inventoryContainer); + } + } + } + } + + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowGeneBank(player, inventory, side, false); + } + + public WindowGeneBank(EntityPlayer player, IInventory inventory, Side side, boolean isNEI) + { + super(320, 224, player, inventory, side); + this.isNei = isNEI; + } + + public void initialiseServer() + { + GeneTracker tracker = GeneTracker.getTracker(getWorld(), getUsername()); + if (tracker != null) { + tracker.synchToPlayer(getPlayer()); + } + } + + public void initialiseClient() + { + setTitle("Gene Bank"); + + addEventHandler(new EventValueChanged.Handler() + { + public void onEvent(EventValueChanged event) + { + if ((event.value instanceof BreedingSystem)) { + WindowGeneBank.this.genes.setValue((BreedingSystem)event.value); + } + } + }); + int boxX = 100; + + int x = 16; + int y = 32; + + new ControlPlayerInventory(this, x, y); + + x += 124; + + boxX = x; + + int geneBoxWidth = 120; + + new Panel(this, boxX + 24, 32.0F, geneBoxWidth, 120.0F, MinecraftGUI.PanelType.Black); + new Panel(this, boxX + 24 + geneBoxWidth, 32.0F, 14.0F, 120.0F, MinecraftGUI.PanelType.Gray); + ControlScrollableContent scroll = new ControlScrollableContent(this, boxX + 24 + 2, 34.0F, geneBoxWidth + 10, 116.0F, 12.0F); + + ControlTextEdit edit = new ControlTextEdit(this, boxX + 27 + geneBoxWidth - 70, 18.0F, 80.0F, 12.0F); + + addEventHandler(new EventTextEdit.Handler() + { + public void onEvent(EventTextEdit event) + { + WindowGeneBank.this.genes.setFilter((String)event.getValue()); + } + }.setOrigin(EventHandler.Origin.Self, edit)); + + + + this.genes = new ControlGeneScroll(scroll, 1.0F, 1.0F, geneBoxWidth, 116.0F); + scroll.setScrollableContent(this.genes); + + + + + + this.genes.setGenes(Binnie.Genetics.beeBreedingSystem); + + ControlTabBar<BreedingSystem> tabBar = new ControlTabBar(this, boxX, 32.0F, 24.0F, 120.0F, Position.Left) + { + public ControlTab<BreedingSystem> createTab(float x, float y, float w, float h, BreedingSystem value) + { + new ControlTabIcon(this, x, y, w, h, value) + { + public void getTooltip(Tooltip tooltip) + { + tooltip.add(((BreedingSystem)getValue()).toString()); + + int totalGenes = 0; + int seqGenes = 0; + + GeneTracker tracker = GeneTracker.getTracker(WindowGeneBank.this.getWorld(), WindowGeneBank.this.getUsername()); + + Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(((BreedingSystem)getValue()).getSpeciesRoot()); + for (Iterator i$ = genes.entrySet().iterator(); i$.hasNext();) + { + entry = (Map.Entry)i$.next(); + totalGenes += ((List)entry.getValue()).size(); + for (IAllele allele : (List)entry.getValue()) + { + Gene gene = new Gene(allele, (IChromosomeType)entry.getKey(), ((BreedingSystem)getValue()).getSpeciesRoot()); + if (tracker.isSequenced(gene)) { + seqGenes++; + } + } + } + Map.Entry<IChromosomeType, List<IAllele>> entry; + tooltip.add("" + seqGenes + "/" + totalGenes + " Genes"); + } + }; + } + }; + tabBar.setValues(Binnie.Genetics.getActiveSystems()); + + tabBar.setValue(Binnie.Genetics.beeBreedingSystem); + + boxX -= 8; + + ControlTabBar<String> infoTabs = new ControlTabBar(this, boxX + 8, 160.0F, 16.0F, 50.0F, Position.Left); + + infoTabs.setValues(Arrays.asList(new String[] { "Stats", "Ranking" })); + + infoTabs.setValue("Info"); + + Panel panelProject = new Panel(this, boxX + 24, 160.0F, geneBoxWidth + 20, 50.0F, MinecraftGUI.PanelType.Black); + + int totalGenes = 0; + int seqGenes = 0; + for (Iterator i$ = Binnie.Genetics.getActiveSystems().iterator(); i$.hasNext();) + { + system = (BreedingSystem)i$.next(); + + tracker = GeneTracker.getTracker(getWorld(), getUsername()); + + Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(system.getSpeciesRoot()); + for (i$ = genes.entrySet().iterator(); i$.hasNext();) + { + entry = (Map.Entry)i$.next(); + totalGenes += ((List)entry.getValue()).size(); + for (IAllele allele : (List)entry.getValue()) + { + Gene gene = new Gene(allele, (IChromosomeType)entry.getKey(), system.getSpeciesRoot()); + if (tracker.isSequenced(gene)) { + seqGenes++; + } + } + } + } + BreedingSystem system; + GeneTracker tracker; + Iterator i$; + Map.Entry<IChromosomeType, List<IAllele>> entry; + new ControlText(panelProject, new IPoint(4.0F, 4.0F), "§nFull Genome Project"); + new ControlText(panelProject, new IPoint(4.0F, 18.0F), "§oSequenced §r" + seqGenes + "/" + totalGenes + " §oGenes"); + } + + public String getTitle() + { + return "Gene Bank"; + } + + public static class ChromosomeType + { + IChromosomeType chromosome; + BreedingSystem system; + + public ChromosomeType(IChromosomeType chromosome, BreedingSystem system) + { + this.chromosome = chromosome; + this.system = system; + } + + public String toString() + { + return this.system.getChromosomeName(this.chromosome); + } + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "GeneBank"; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowGeneBankNEI.java b/src/Java/binnie/craftgui/genetics/machine/WindowGeneBankNEI.java new file mode 100644 index 0000000000..08e680c68d --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowGeneBankNEI.java @@ -0,0 +1,14 @@ +package binnie.craftgui.genetics.machine; + +import binnie.craftgui.minecraft.Window; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowGeneBankNEI +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowGeneBank(player, inventory, side, true); + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowGeneProject.java b/src/Java/binnie/craftgui/genetics/machine/WindowGeneProject.java new file mode 100644 index 0000000000..c79e6f7d0c --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowGeneProject.java @@ -0,0 +1,32 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.minecraft.Window; +import binnie.genetics.Genetics; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowGeneProject + extends Window +{ + public WindowGeneProject(EntityPlayer player, IInventory inventory, Side side) + { + super(100.0F, 100.0F, player, inventory, side); + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "GeneProjects"; + } + + public void initialiseClient() + { + setTitle("Gene Projects"); + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowGenepool.java b/src/Java/binnie/craftgui/genetics/machine/WindowGenepool.java new file mode 100644 index 0000000000..c91b95c0bb --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowGenepool.java @@ -0,0 +1,96 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.core.geometry.Position; +import binnie.craftgui.minecraft.GUIIcon; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlEnergyBar; +import binnie.craftgui.minecraft.control.ControlErrorState; +import binnie.craftgui.minecraft.control.ControlIconDisplay; +import binnie.craftgui.minecraft.control.ControlLiquidTank; +import binnie.craftgui.minecraft.control.ControlMachineProgress; +import binnie.craftgui.minecraft.control.ControlPlayerInventory; +import binnie.craftgui.minecraft.control.ControlSlot; +import binnie.craftgui.minecraft.control.ControlSlotArray; +import binnie.craftgui.minecraft.control.ControlSlotCharge; +import binnie.craftgui.resource.Texture; +import binnie.craftgui.resource.minecraft.StandardTexture; +import binnie.extrabees.core.ExtraBeeTexture; +import binnie.genetics.Genetics; +import binnie.genetics.machine.Genepool; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowGenepool + extends WindowMachine +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowGenepool(player, inventory, side); + } + + public WindowGenepool(EntityPlayer player, IInventory inventory, Side side) + { + super(280, 198, player, inventory, side); + } + + static Texture ProgressBase = new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture()); + static Texture Progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture()); + + public void initialiseClient() + { + setTitle("Genepool"); + + int x = 16; + int y = 32; + + new ControlLiquidTank(this, x, y).setTankID(1); + + x += 26; + + new ControlSlotArray(this, x, y + 3, 2, 3).create(Genepool.slotReserve); + + x += 38; + + new ControlIconDisplay(this, x, y + 3 + 18 + 1, GUIIcon.ArrowRight.getIcon()); + + x += 18; + + new ControlSlot(this, x, y + 3 + 18).assign(0); + + x += 18; + + new ControlMachineProgress(this, x, y + 19, ProgressBase, 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).setColour(15722671); + + + new ControlErrorState(this, 181.0F, 83.0F); + + new ControlPlayerInventory(this); + } + + public String getTitle() + { + return "Genepool"; + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "Genepool"; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowGenomeAssembler.java b/src/Java/binnie/craftgui/genetics/machine/WindowGenomeAssembler.java new file mode 100644 index 0000000000..d6e31c3c69 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowGenomeAssembler.java @@ -0,0 +1,37 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.minecraft.Window; +import binnie.genetics.Genetics; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowGenomeAssembler + extends WindowMachine +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowGenomeAssembler(player, inventory, side); + } + + public WindowGenomeAssembler(EntityPlayer player, IInventory inventory, Side side) + { + super(320, 240, player, inventory, side); + } + + public String getTitle() + { + return "Genome Assembler"; + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "GenomeAssembler"; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowIncubator.java b/src/Java/binnie/craftgui/genetics/machine/WindowIncubator.java new file mode 100644 index 0000000000..f52a0b1717 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowIncubator.java @@ -0,0 +1,99 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.core.geometry.Position; +import binnie.craftgui.minecraft.GUIIcon; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlEnergyBar; +import binnie.craftgui.minecraft.control.ControlErrorState; +import binnie.craftgui.minecraft.control.ControlIconDisplay; +import binnie.craftgui.minecraft.control.ControlLiquidTank; +import binnie.craftgui.minecraft.control.ControlMachineProgress; +import binnie.craftgui.minecraft.control.ControlPlayerInventory; +import binnie.craftgui.minecraft.control.ControlSlot; +import binnie.craftgui.minecraft.control.ControlSlotArray; +import binnie.craftgui.resource.Texture; +import binnie.craftgui.resource.minecraft.StandardTexture; +import binnie.genetics.Genetics; +import binnie.genetics.core.GeneticsTexture; +import binnie.genetics.machine.Incubator; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowIncubator + extends WindowMachine +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowIncubator(player, inventory, side); + } + + public WindowIncubator(EntityPlayer player, IInventory inventory, Side side) + { + super(228, 196, player, inventory, side); + } + + static Texture ProgressBase = new StandardTexture(0, 91, 38, 32, GeneticsTexture.GUIProcess); + static Texture Progress = new StandardTexture(38, 91, 38, 32, GeneticsTexture.GUIProcess); + + public void initialiseClient() + { + setTitle("Incubator"); + + int x = 16; + int y = 32; + + + new ControlLiquidTank(this, x, y).setTankID(0); + + x += 26; + + new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.slotQueue); + + x += 20; + + new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon()); + + x += 18; + + new ControlMachineProgress(this, x, y + 6, ProgressBase, 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()); + + x += 18; + + new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.slotOutput); + + x += 26; + + new ControlLiquidTank(this, x, y).setTankID(1); + + x += 34; + + new ControlEnergyBar(this, x, y + 3, 16, 54, Position.Bottom); + + new ControlErrorState(this, 91.0F, 82.0F); + + new ControlPlayerInventory(this); + } + + public String getTitle() + { + return "Incubator"; + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "Incubator"; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowInoculator.java b/src/Java/binnie/craftgui/genetics/machine/WindowInoculator.java new file mode 100644 index 0000000000..894170efd0 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowInoculator.java @@ -0,0 +1,107 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.geometry.CraftGUIUtil; +import binnie.craftgui.core.geometry.Position; +import binnie.craftgui.core.geometry.TextJustification; +import binnie.craftgui.minecraft.GUIIcon; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlEnergyBar; +import binnie.craftgui.minecraft.control.ControlErrorState; +import binnie.craftgui.minecraft.control.ControlIconDisplay; +import binnie.craftgui.minecraft.control.ControlLiquidTank; +import binnie.craftgui.minecraft.control.ControlMachineProgress; +import binnie.craftgui.minecraft.control.ControlPlayerInventory; +import binnie.craftgui.minecraft.control.ControlSlot; +import binnie.craftgui.minecraft.control.ControlSlotArray; +import binnie.craftgui.resource.Texture; +import binnie.craftgui.resource.minecraft.StandardTexture; +import binnie.genetics.Genetics; +import binnie.genetics.core.GeneticsTexture; +import binnie.genetics.machine.Inoculator; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowInoculator + extends WindowMachine +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowInoculator(player, inventory, side); + } + + public WindowInoculator(EntityPlayer player, IInventory inventory, Side side) + { + super(266, 240, player, inventory, side); + } + + static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2.getTexture()); + static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2.getTexture()); + + public void initialiseClient() + { + setTitle("Inoculator"); + + int x = 16; + int y = 32; + + + new ControlLiquidTank(this, x, y + 18 + 16).setTankID(0); + + + CraftGUIUtil.horizontalGrid(x, y, new IWidget[] { new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.slotSerumReserve), 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.slotSerumExpended) }); + + + + + + + + + x += 18; + + new ControlMachineProgress(this, x, y + 24, ProgressBase, 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 IWidget[] { new ControlSlotArray(this, x, y, 4, 1).create(Inoculator.slotReserve), new ControlSlot(this, x, y + 18 + 8).assign(9), new ControlSlotArray(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.slotFinished) }); + + + + + + new ControlIconDisplay(this, x + 18, y + 18 + 2, GUIIcon.ArrowUpLeft.getIcon()); + new ControlIconDisplay(this, x + 18, y + 18 + 18, GUIIcon.ArrowLeftDown.getIcon()); + + + + + + + + new ControlPlayerInventory(this); + } + + public String getTitle() + { + return "Inoculator"; + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "Inoculator"; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowIsolator.java b/src/Java/binnie/craftgui/genetics/machine/WindowIsolator.java new file mode 100644 index 0000000000..6d494250ee --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowIsolator.java @@ -0,0 +1,116 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.core.geometry.Position; +import binnie.craftgui.minecraft.GUIIcon; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlEnergyBar; +import binnie.craftgui.minecraft.control.ControlErrorState; +import binnie.craftgui.minecraft.control.ControlIconDisplay; +import binnie.craftgui.minecraft.control.ControlLiquidTank; +import binnie.craftgui.minecraft.control.ControlPlayerInventory; +import binnie.craftgui.minecraft.control.ControlProgress; +import binnie.craftgui.minecraft.control.ControlSlot; +import binnie.craftgui.minecraft.control.ControlSlotArray; +import binnie.craftgui.minecraft.control.ControlSlotCharge; +import binnie.craftgui.resource.Texture; +import binnie.craftgui.resource.minecraft.StandardTexture; +import binnie.extrabees.core.ExtraBeeTexture; +import binnie.genetics.Genetics; +import binnie.genetics.machine.Isolator; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowIsolator + extends WindowMachine +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowIsolator(player, inventory, side); + } + + static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, ExtraBeeTexture.GUIProgress.getTexture()); + static Texture Progress = new StandardTexture(0, 201, 142, 17, ExtraBeeTexture.GUIProgress.getTexture()); + + public WindowIsolator(EntityPlayer player, IInventory inventory, Side side) + { + super(330, 208, player, inventory, side); + } + + public void initialiseClient() + { + setTitle("Isolator"); + + int x = 16; + int y = 32; + + new ControlLiquidTank(this, x, y).setTankID(0); + + x += 26; + + new ControlSlotArray(this, x, y + 3, 1, 3).create(Isolator.slotReserve); + + x += 20; + + new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon()); + + x += 18; + + new ControlSlot(this, x, y + 3).assign(5); + + new ControlSlot(this, x, y + 36 + 3).assign(0); + new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColour(15722671); + + + + x += 18; + + new ControlProgress(this, x, y + 3, ProgressBase, Progress, Position.Left); + + x += 142; + + new ControlSlot(this, x, y + 3).assign(6); + + new ControlSlot(this, x, y + 3 + 36).assign(1); + + new ControlIconDisplay(this, x + 1, y + 3 + 19, GUIIcon.ArrowUp.getIcon()); + + x += 20; + + + new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon()); + + x += 18; + + new ControlSlotArray(this, x, y + 3, 2, 3).create(Isolator.slotFinished); + + + new ControlEnergyBar(this, 260, 130, 16, 60, Position.Bottom); + + + + + + + + new ControlErrorState(this, 153.0F, 81.0F); + + new ControlPlayerInventory(this); + } + + public String getTitle() + { + return "Incubator"; + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "Isolator"; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowMachine.java b/src/Java/binnie/craftgui/genetics/machine/WindowMachine.java new file mode 100644 index 0000000000..6b357a36d7 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowMachine.java @@ -0,0 +1,22 @@ +package binnie.craftgui.genetics.machine; + +import binnie.craftgui.minecraft.Window; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public abstract class WindowMachine + extends Window +{ + public WindowMachine(int width, int height, EntityPlayer player, IInventory inventory, Side side) + { + super(width, height, player, inventory, side); + } + + public abstract String getTitle(); + + public void initialiseClient() + { + setTitle(getTitle()); + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowPolymeriser.java b/src/Java/binnie/craftgui/genetics/machine/WindowPolymeriser.java new file mode 100644 index 0000000000..edf9e371f7 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowPolymeriser.java @@ -0,0 +1,101 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.core.geometry.Position; +import binnie.craftgui.minecraft.GUIIcon; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlEnergyBar; +import binnie.craftgui.minecraft.control.ControlErrorState; +import binnie.craftgui.minecraft.control.ControlIconDisplay; +import binnie.craftgui.minecraft.control.ControlLiquidTank; +import binnie.craftgui.minecraft.control.ControlMachineProgress; +import binnie.craftgui.minecraft.control.ControlPlayerInventory; +import binnie.craftgui.minecraft.control.ControlSlot; +import binnie.craftgui.minecraft.control.ControlSlotArray; +import binnie.craftgui.minecraft.control.ControlSlotCharge; +import binnie.craftgui.resource.Texture; +import binnie.craftgui.resource.minecraft.StandardTexture; +import binnie.genetics.Genetics; +import binnie.genetics.core.GeneticsTexture; +import binnie.genetics.machine.Polymeriser; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowPolymeriser + extends WindowMachine +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowPolymeriser(player, inventory, side); + } + + public WindowPolymeriser(EntityPlayer player, IInventory inventory, Side side) + { + super(278, 212, player, inventory, side); + } + + static Texture ProgressBase = new StandardTexture(76, 170, 160, 79, GeneticsTexture.GUIProcess.getTexture()); + static Texture Progress = new StandardTexture(76, 91, 160, 79, GeneticsTexture.GUIProcess.getTexture()); + + public void initialiseClient() + { + super.initialiseClient(); + + int x = 16; + int y = 38; + + + + + + new ControlSlotArray(this, x, y, 1, 4).create(Polymeriser.slotSerumReserve); + new ControlIconDisplay(this, x + 18, y + 1, GUIIcon.ArrowRight.getIcon()); + + x += 34; + + new ControlMachineProgress(this, x + 18, y - 6, ProgressBase, 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); + + x += 40; + + new ControlSlot(this, x + 30, y + 18 + 8).assign(1); + new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColour(16766976); + + + + + x += 138; + + new ControlSlotArray(this, x, y + 9, 2, 2).create(Polymeriser.slotSerumFinished); + + ControlErrorState errorState = new ControlErrorState(this, 244.0F, 97.0F); + + + new ControlPlayerInventory(this); + } + + public String getTitle() + { + return "Polymeriser"; + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "Polymeriser"; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowSequencer.java b/src/Java/binnie/craftgui/genetics/machine/WindowSequencer.java new file mode 100644 index 0000000000..9e2f580b53 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowSequencer.java @@ -0,0 +1,116 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.controls.ControlText; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.geometry.CraftGUIUtil; +import binnie.craftgui.core.geometry.IArea; +import binnie.craftgui.core.geometry.Position; +import binnie.craftgui.core.geometry.TextJustification; +import binnie.craftgui.minecraft.GUIIcon; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlEnergyBar; +import binnie.craftgui.minecraft.control.ControlErrorState; +import binnie.craftgui.minecraft.control.ControlIconDisplay; +import binnie.craftgui.minecraft.control.ControlPlayerInventory; +import binnie.craftgui.minecraft.control.ControlSlot; +import binnie.craftgui.minecraft.control.ControlSlotArray; +import binnie.craftgui.minecraft.control.ControlSlotCharge; +import binnie.craftgui.resource.Texture; +import binnie.craftgui.resource.minecraft.StandardTexture; +import binnie.extrabees.core.ExtraBeeTexture; +import binnie.genetics.Genetics; +import binnie.genetics.machine.Sequencer; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagCompound; + +public class WindowSequencer + extends WindowMachine +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowSequencer(player, inventory, side); + } + + public WindowSequencer(EntityPlayer player, IInventory inventory, Side side) + { + super(226, 224, player, inventory, side); + } + + static Texture ProgressBase = new StandardTexture(64, 114, 98, 9, ExtraBeeTexture.GUIProgress.getTexture()); + static Texture Progress = new StandardTexture(64, 123, 98, 9, ExtraBeeTexture.GUIProgress.getTexture()); + ControlText slotText; + + public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound action) + { + if ((side == Side.CLIENT) && (name.equals("username"))) { + this.slotText.setValue("§8Genes will be sequenced by " + action.getString("username")); + } + super.recieveGuiNBT(side, player, name, action); + } + + public void initialiseClient() + { + setTitle("Sequencer"); + + + int x = 16; + int y = 32; + + + + + CraftGUIUtil.horizontalGrid(x, y, TextJustification.MiddleCenter, 2.0F, new IWidget[] { new ControlSlotArray(this, 0, 0, 2, 2).create(Sequencer.slotReserve), new ControlIconDisplay(this, 0.0F, 0.0F, GUIIcon.ArrowRight.getIcon()), new ControlSequencerProgress(this, 0, 0), new ControlIconDisplay(this, 0.0F, 0.0F, GUIIcon.ArrowRight.getIcon()), new ControlSlot(this, 0.0F, 0.0F).assign(6) }); + + + + + + + + + ControlSlot slotTarget = new ControlSlot(this, x + 96, y + 16); + slotTarget.assign(5); + + x = 34; + y = 92; + + this.slotText = new ControlText(this, new IArea(0.0F, y, w(), 12.0F), "§8Userless. Will not save sequences", TextJustification.MiddleCenter); + + + + y += 20; + + ControlSlot slotDye = new ControlSlot(this, x, y); + slotDye.assign(0); + x += 20; + new ControlSlotCharge(this, x, y, 0).setColour(16750848); + + x += 32; + new ControlEnergyBar(this, x, y, 60, 16, Position.Left); + + x += 92; + ControlErrorState errorState = new ControlErrorState(this, x, y + 1); + + + + new ControlPlayerInventory(this); + } + + public String getTitle() + { + return "Incubator"; + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "Sequencer"; + } +} diff --git a/src/Java/binnie/craftgui/genetics/machine/WindowSplicer.java b/src/Java/binnie/craftgui/genetics/machine/WindowSplicer.java new file mode 100644 index 0000000000..23d7cd8015 --- /dev/null +++ b/src/Java/binnie/craftgui/genetics/machine/WindowSplicer.java @@ -0,0 +1,93 @@ +package binnie.craftgui.genetics.machine; + +import binnie.core.AbstractMod; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.geometry.CraftGUIUtil; +import binnie.craftgui.core.geometry.Position; +import binnie.craftgui.core.geometry.TextJustification; +import binnie.craftgui.minecraft.GUIIcon; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.minecraft.control.ControlEnergyBar; +import binnie.craftgui.minecraft.control.ControlErrorState; +import binnie.craftgui.minecraft.control.ControlIconDisplay; +import binnie.craftgui.minecraft.control.ControlPlayerInventory; +import binnie.craftgui.minecraft.control.ControlSlot; +import binnie.craftgui.minecraft.control.ControlSlotArray; +import binnie.craftgui.resource.Texture; +import binnie.craftgui.resource.minecraft.StandardTexture; +import binnie.genetics.Genetics; +import binnie.genetics.core.GeneticsTexture; +import binnie.genetics.machine.Inoculator; +import binnie.genetics.machine.Splicer; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; + +public class WindowSplicer + extends WindowMachine +{ + public static Window create(EntityPlayer player, IInventory inventory, Side side) + { + return new WindowSplicer(player, inventory, side); + } + + public WindowSplicer(EntityPlayer player, IInventory inventory, Side side) + { + super(280, 240, player, inventory, side); + } + + static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2.getTexture()); + static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2.getTexture()); + + public void initialiseClient() + { + setTitle("Splicer"); + + int x = 16; + + + + + new ControlSplicerProgress(this, 84.0F, 32.0F, w() - 172.0F, 102.0F); + + CraftGUIUtil.horizontalGrid(x, 62.0F, new IWidget[] { new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.slotSerumReserve), 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.slotSerumExpended); + + new ControlIconDisplay(this, x + 12 + 36 + 4, 86.0F, GUIIcon.ArrowUpLeft.getIcon()); + + + + new ControlEnergyBar(this, 196, 64, 60, 16, Position.Left); + new ControlErrorState(this, 218.0F, 86.0F); + + x += 142; + + CraftGUIUtil.verticalGrid((w() - 72.0F) / 2.0F, 32.0F, TextJustification.MiddleCenter, 4.0F, new IWidget[] { new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.slotReserve), 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.slotFinished) }); + + + + + + + new ControlPlayerInventory(this); + } + + public String getTitle() + { + return "Inoculator"; + } + + protected AbstractMod getMod() + { + return Genetics.instance; + } + + protected String getName() + { + return "Inoculator"; + } +} |