mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-24 22:14:44 +00:00
Update buildscript & spotlessApply
This commit is contained in:
1 parent
e4329e2b8f
commit
8683a345c3
818 files changed
+51123
-49403
No files matched your search
@@ -24,95 +24,91 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
@Mod(
|
||||
modid = "Genetics",
|
||||
name = "Genetics",
|
||||
version = BinnieCore.VERSION,
|
||||
useMetadata = true,
|
||||
dependencies = "after:BinnieCore"
|
||||
)
|
||||
modid = "Genetics",
|
||||
name = "Genetics",
|
||||
version = BinnieCore.VERSION,
|
||||
useMetadata = true,
|
||||
dependencies = "after:BinnieCore")
|
||||
public class Genetics extends AbstractMod {
|
||||
@Mod.Instance("Genetics")
|
||||
public static Genetics instance;
|
||||
@Mod.Instance("Genetics")
|
||||
public static Genetics instance;
|
||||
|
||||
@SidedProxy(
|
||||
clientSide = "binnie.genetics.proxy.ProxyClient",
|
||||
serverSide = "binnie.genetics.proxy.ProxyServer"
|
||||
)
|
||||
public static Proxy proxy;
|
||||
@SidedProxy(clientSide = "binnie.genetics.proxy.ProxyClient", serverSide = "binnie.genetics.proxy.ProxyServer")
|
||||
public static Proxy proxy;
|
||||
|
||||
public static ItemSerumArray itemSerumArray = null;
|
||||
public static final String CHANNEL = "GEN";
|
||||
public static Item itemGenetics;
|
||||
public static Item itemSerum;
|
||||
public static Item itemSequencer;
|
||||
public static MachineGroup packageGenetic;
|
||||
public static MachineGroup packageAdvGenetic;
|
||||
public static MachineGroup packageLabMachine;
|
||||
public static ItemDatabase database;
|
||||
public static ItemAnalyst analyst;
|
||||
public static Item registry;
|
||||
public static Item masterRegistry;
|
||||
public static ItemSerumArray itemSerumArray = null;
|
||||
public static final String CHANNEL = "GEN";
|
||||
public static Item itemGenetics;
|
||||
public static Item itemSerum;
|
||||
public static Item itemSequencer;
|
||||
public static MachineGroup packageGenetic;
|
||||
public static MachineGroup packageAdvGenetic;
|
||||
public static MachineGroup packageLabMachine;
|
||||
public static ItemDatabase database;
|
||||
public static ItemAnalyst analyst;
|
||||
public static Item registry;
|
||||
public static Item masterRegistry;
|
||||
|
||||
public Genetics() {
|
||||
Genetics.instance = this;
|
||||
}
|
||||
public Genetics() {
|
||||
Genetics.instance = this;
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
addModule(new ModuleItem());
|
||||
addModule(new ModuleMachine());
|
||||
IMCForNEI.IMCSender();
|
||||
preInit();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
addModule(new ModuleItem());
|
||||
addModule(new ModuleMachine());
|
||||
IMCForNEI.IMCSender();
|
||||
preInit();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
init();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
postInit();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
postInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return GeneticsGUI.values();
|
||||
}
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return GeneticsGUI.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return GeneticsPacket.values();
|
||||
}
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return GeneticsPacket.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return CHANNEL;
|
||||
}
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return CHANNEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProxyCore getProxy() {
|
||||
return Genetics.proxy;
|
||||
}
|
||||
@Override
|
||||
public IProxyCore getProxy() {
|
||||
return Genetics.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
return "genetics";
|
||||
}
|
||||
@Override
|
||||
public String getModID() {
|
||||
return "genetics";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return BinnieCore.isGeneticsActive();
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return BinnieCore.isGeneticsActive();
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(Genetics.instance);
|
||||
}
|
||||
}
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(Genetics.instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,35 +9,35 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class GeneticsCreativeTab extends CreativeTabs {
|
||||
public static CreativeTabs instance;
|
||||
public static CreativeTabs instance;
|
||||
|
||||
static {
|
||||
GeneticsCreativeTab.instance = new GeneticsCreativeTab();
|
||||
}
|
||||
static {
|
||||
GeneticsCreativeTab.instance = new GeneticsCreativeTab();
|
||||
}
|
||||
|
||||
public GeneticsCreativeTab() {
|
||||
super("Genetics");
|
||||
}
|
||||
public GeneticsCreativeTab() {
|
||||
super("Genetics");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return GeneticsItems.EmptySerum.get(1);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return GeneticsItems.EmptySerum.get(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslatedTabLabel() {
|
||||
return getTabLabel();
|
||||
}
|
||||
@Override
|
||||
public String getTranslatedTabLabel() {
|
||||
return getTabLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTabLabel() {
|
||||
return I18N.localise("extrabees.tab.genetics");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTabLabel() {
|
||||
return I18N.localise("extrabees.tab.genetics");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getTabIconItem() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getTabIconItem() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,13 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface IGene extends INBTTagable {
|
||||
IChromosomeType getChromosome();
|
||||
IChromosomeType getChromosome();
|
||||
|
||||
String getName();
|
||||
String getName();
|
||||
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
IAllele getAllele();
|
||||
IAllele getAllele();
|
||||
|
||||
NBTTagCompound getNBTTagCompound();
|
||||
NBTTagCompound getNBTTagCompound();
|
||||
}
|
||||
@@ -1,36 +1,34 @@
|
||||
package binnie.genetics.api;
|
||||
|
||||
import binnie.core.machines.MachineUtil;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface IIncubatorRecipe {
|
||||
boolean isInputLiquid(FluidStack liquid);
|
||||
boolean isInputLiquid(FluidStack liquid);
|
||||
|
||||
boolean isInputLiquidSufficient(FluidStack liquid);
|
||||
boolean isInputLiquidSufficient(FluidStack liquid);
|
||||
|
||||
@Deprecated
|
||||
boolean isItemStack(ItemStack stack);
|
||||
@Deprecated
|
||||
boolean isItemStack(ItemStack stack);
|
||||
|
||||
void doTask(MachineUtil machine);
|
||||
void doTask(MachineUtil machine);
|
||||
|
||||
float getChance();
|
||||
float getChance();
|
||||
|
||||
boolean roomForOutput(MachineUtil machine);
|
||||
boolean roomForOutput(MachineUtil machine);
|
||||
|
||||
float getLossChance();
|
||||
float getLossChance();
|
||||
|
||||
@Nullable
|
||||
FluidStack getInput();
|
||||
@Nullable
|
||||
FluidStack getInput();
|
||||
|
||||
@Nullable
|
||||
FluidStack getOutput();
|
||||
@Nullable
|
||||
FluidStack getOutput();
|
||||
|
||||
@Nullable
|
||||
ItemStack getInputStack();
|
||||
|
||||
ItemStack getExpectedOutput();
|
||||
@Nullable
|
||||
ItemStack getInputStack();
|
||||
|
||||
ItemStack getExpectedOutput();
|
||||
}
|
||||
@@ -3,10 +3,10 @@ package binnie.genetics.api;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IItemAnalysable {
|
||||
boolean isAnalysed(ItemStack stack);
|
||||
boolean isAnalysed(ItemStack stack);
|
||||
|
||||
ItemStack analyse(ItemStack stack);
|
||||
ItemStack analyse(ItemStack stack);
|
||||
|
||||
@Deprecated
|
||||
float getAnalyseTimeMult(ItemStack stack);
|
||||
@Deprecated
|
||||
float getAnalyseTimeMult(ItemStack stack);
|
||||
}
|
||||
@@ -3,5 +3,5 @@ package binnie.genetics.api;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IItemChargable {
|
||||
int getCharges(ItemStack stack);
|
||||
int getCharges(ItemStack stack);
|
||||
}
|
||||
@@ -4,11 +4,11 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IItemSerum extends IItemChargable {
|
||||
IGene[] getGenes(ItemStack stack);
|
||||
IGene[] getGenes(ItemStack stack);
|
||||
|
||||
ISpeciesRoot getSpeciesRoot(ItemStack stack);
|
||||
ISpeciesRoot getSpeciesRoot(ItemStack stack);
|
||||
|
||||
IGene getGene(ItemStack stack, int chromosome);
|
||||
IGene getGene(ItemStack stack, int chromosome);
|
||||
|
||||
ItemStack addGene(ItemStack stack, IGene gene);
|
||||
ItemStack addGene(ItemStack stack, IGene gene);
|
||||
}
|
||||
@@ -3,5 +3,4 @@ package binnie.genetics.config;
|
||||
import binnie.core.mod.config.ConfigFile;
|
||||
|
||||
@ConfigFile(filename = "/config/forestry/genetics/main.conf")
|
||||
public class ConfigurationMain {
|
||||
}
|
||||
public class ConfigurationMain {}
|
||||
@@ -15,75 +15,74 @@ import binnie.genetics.craftgui.WindowSequencer;
|
||||
import binnie.genetics.craftgui.WindowSplicer;
|
||||
import binnie.genetics.gui.WindowAnalyst;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import java.lang.reflect.Constructor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
public enum GeneticsGUI implements IBinnieGUID {
|
||||
Genepool(WindowGenepool.class),
|
||||
Isolator(WindowIsolator.class),
|
||||
Sequencer(WindowSequencer.class),
|
||||
Replicator(WindowPolymeriser.class),
|
||||
Inoculator(WindowInoculator.class),
|
||||
GeneBank(WindowGeneBank.class),
|
||||
Analyser(WindowAnalyser.class),
|
||||
Incubator(WindowIncubator.class),
|
||||
Database(WindowGeneBank.class),
|
||||
DatabaseNEI(WindowGeneBankNEI.class),
|
||||
Acclimatiser(WindowAcclimatiser.class),
|
||||
Splicer(WindowSplicer.class),
|
||||
Analyst,
|
||||
Registry,
|
||||
MasterRegistry;
|
||||
Genepool(WindowGenepool.class),
|
||||
Isolator(WindowIsolator.class),
|
||||
Sequencer(WindowSequencer.class),
|
||||
Replicator(WindowPolymeriser.class),
|
||||
Inoculator(WindowInoculator.class),
|
||||
GeneBank(WindowGeneBank.class),
|
||||
Analyser(WindowAnalyser.class),
|
||||
Incubator(WindowIncubator.class),
|
||||
Database(WindowGeneBank.class),
|
||||
DatabaseNEI(WindowGeneBankNEI.class),
|
||||
Acclimatiser(WindowAcclimatiser.class),
|
||||
Splicer(WindowSplicer.class),
|
||||
Analyst,
|
||||
Registry,
|
||||
MasterRegistry;
|
||||
|
||||
protected Class<? extends Window> windowClass;
|
||||
protected Class<? extends Window> windowClass;
|
||||
|
||||
GeneticsGUI() {
|
||||
// ignored
|
||||
}
|
||||
GeneticsGUI() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
GeneticsGUI(Class window) {
|
||||
windowClass = window;
|
||||
}
|
||||
GeneticsGUI(Class window) {
|
||||
windowClass = window;
|
||||
}
|
||||
|
||||
public Window getWindow(EntityPlayer player, IInventory object, Side side) throws Exception {
|
||||
switch (this) {
|
||||
case Analyst:
|
||||
return new WindowAnalyst(player, null, side, false, false);
|
||||
public Window getWindow(EntityPlayer player, IInventory object, Side side) throws Exception {
|
||||
switch (this) {
|
||||
case Analyst:
|
||||
return new WindowAnalyst(player, null, side, false, false);
|
||||
|
||||
case MasterRegistry:
|
||||
return new WindowAnalyst(player, null, side, true, true);
|
||||
case MasterRegistry:
|
||||
return new WindowAnalyst(player, null, side, true, true);
|
||||
|
||||
case Registry:
|
||||
return new WindowAnalyst(player, null, side, true, false);
|
||||
}
|
||||
Constructor constr = windowClass.getConstructor(EntityPlayer.class, IInventory.class, Side.class);
|
||||
return (Window) constr.newInstance(player, object, side);
|
||||
}
|
||||
case Registry:
|
||||
return new WindowAnalyst(player, null, side, true, false);
|
||||
}
|
||||
Constructor constr = windowClass.getConstructor(EntityPlayer.class, IInventory.class, Side.class);
|
||||
return (Window) constr.newInstance(player, object, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) {
|
||||
Window window = null;
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
IInventory object = null;
|
||||
if (tileEntity instanceof IInventory) {
|
||||
object = (IInventory) tileEntity;
|
||||
}
|
||||
@Override
|
||||
public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) {
|
||||
Window window = null;
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
IInventory object = null;
|
||||
if (tileEntity instanceof IInventory) {
|
||||
object = (IInventory) tileEntity;
|
||||
}
|
||||
|
||||
try {
|
||||
if (this == GeneticsGUI.Database || this == GeneticsGUI.GeneBank) {
|
||||
window = WindowGeneBank.create(player, object, side);
|
||||
} else if (this == GeneticsGUI.DatabaseNEI) {
|
||||
window = WindowGeneBankNEI.create(player, object, side);
|
||||
} else {
|
||||
window = getWindow(player, object, side);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return window;
|
||||
}
|
||||
try {
|
||||
if (this == GeneticsGUI.Database || this == GeneticsGUI.GeneBank) {
|
||||
window = WindowGeneBank.create(player, object, side);
|
||||
} else if (this == GeneticsGUI.DatabaseNEI) {
|
||||
window = WindowGeneBankNEI.create(player, object, side);
|
||||
} else {
|
||||
window = getWindow(player, object, side);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return window;
|
||||
}
|
||||
}
|
||||
@@ -10,20 +10,20 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public enum GeneticsPacket implements IPacketID {
|
||||
GeneTrackerSync;
|
||||
GeneTrackerSync;
|
||||
|
||||
@Override
|
||||
public void onMessage(MessageBinnie message, MessageContext context) {
|
||||
if (this != GeneticsPacket.GeneTrackerSync || context.side != Side.CLIENT) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void onMessage(MessageBinnie message, MessageContext context) {
|
||||
if (this != GeneticsPacket.GeneTrackerSync || context.side != Side.CLIENT) {
|
||||
return;
|
||||
}
|
||||
|
||||
MessageNBT packet = new MessageNBT(message);
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
GeneTracker tracker;
|
||||
tracker = GeneTracker.getTracker(BinnieCore.proxy.getWorld(), player.getGameProfile());
|
||||
if (tracker != null) {
|
||||
tracker.readFromNBT(packet.getTagCompound());
|
||||
}
|
||||
}
|
||||
MessageNBT packet = new MessageNBT(message);
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
GeneTracker tracker;
|
||||
tracker = GeneTracker.getTracker(BinnieCore.proxy.getWorld(), player.getGameProfile());
|
||||
if (tracker != null) {
|
||||
tracker.readFromNBT(packet.getTagCompound());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,34 +8,34 @@ import binnie.core.resource.ResourceType;
|
||||
import binnie.genetics.Genetics;
|
||||
|
||||
public enum GeneticsTexture implements IBinnieTexture {
|
||||
GeneticMachine(ResourceType.Tile, "GeneticMachine"),
|
||||
Genepool(ResourceType.Tile, "Genepool"),
|
||||
Incubator(ResourceType.Tile, "Incubator"),
|
||||
GUIProcess(ResourceType.GUI, "process"),
|
||||
GUIProcess2(ResourceType.GUI, "process2"),
|
||||
Isolator(ResourceType.Tile, "Isolator"),
|
||||
Sequencer(ResourceType.Tile, "Sequencer"),
|
||||
Polymeriser(ResourceType.Tile, "Polymeriser"),
|
||||
Inoculator(ResourceType.Tile, "Inoculator"),
|
||||
Analyser(ResourceType.Tile, "Analyser"),
|
||||
MachineGlow(ResourceType.Tile, "MachineGlow"),
|
||||
GeneBank(ResourceType.Tile, "GeneBank"),
|
||||
LabMachine(ResourceType.Tile, "LabMachine"),
|
||||
Acclimatiser(ResourceType.Tile, "Acclimatiser"),
|
||||
Splicer(ResourceType.Tile, "Splicer");
|
||||
GeneticMachine(ResourceType.Tile, "GeneticMachine"),
|
||||
Genepool(ResourceType.Tile, "Genepool"),
|
||||
Incubator(ResourceType.Tile, "Incubator"),
|
||||
GUIProcess(ResourceType.GUI, "process"),
|
||||
GUIProcess2(ResourceType.GUI, "process2"),
|
||||
Isolator(ResourceType.Tile, "Isolator"),
|
||||
Sequencer(ResourceType.Tile, "Sequencer"),
|
||||
Polymeriser(ResourceType.Tile, "Polymeriser"),
|
||||
Inoculator(ResourceType.Tile, "Inoculator"),
|
||||
Analyser(ResourceType.Tile, "Analyser"),
|
||||
MachineGlow(ResourceType.Tile, "MachineGlow"),
|
||||
GeneBank(ResourceType.Tile, "GeneBank"),
|
||||
LabMachine(ResourceType.Tile, "LabMachine"),
|
||||
Acclimatiser(ResourceType.Tile, "Acclimatiser"),
|
||||
Splicer(ResourceType.Tile, "Splicer");
|
||||
|
||||
public static BinnieIcon dnaIcon = Binnie.Resource.getItemIcon(Genetics.instance, "dna");
|
||||
public static BinnieIcon dnaIcon = Binnie.Resource.getItemIcon(Genetics.instance, "dna");
|
||||
|
||||
protected String texture;
|
||||
protected ResourceType type;
|
||||
protected String texture;
|
||||
protected ResourceType type;
|
||||
|
||||
GeneticsTexture(ResourceType base, String texture) {
|
||||
this.texture = texture;
|
||||
type = base;
|
||||
}
|
||||
GeneticsTexture(ResourceType base, String texture) {
|
||||
this.texture = texture;
|
||||
type = base;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinnieResource getTexture() {
|
||||
return Binnie.Resource.getPNG(Genetics.instance, type, texture);
|
||||
}
|
||||
@Override
|
||||
public BinnieResource getTexture() {
|
||||
return Binnie.Resource.getPNG(Genetics.instance, type, texture);
|
||||
}
|
||||
}
|
||||
@@ -18,75 +18,76 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ControlGene extends Control implements IControlValue<IGene>, ITooltip {
|
||||
protected IGene gene;
|
||||
protected IGene gene;
|
||||
|
||||
protected ControlGene(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
addSelfEventHandler(new MouseDownHandler());
|
||||
}
|
||||
protected ControlGene(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
addSelfEventHandler(new MouseDownHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
String cName = Binnie.Genetics.getSystem(gene.getSpeciesRoot()).getChromosomeName(gene.getChromosome());
|
||||
tooltip.add(cName + ": " + gene.getName());
|
||||
if (isMouseOver() && canFill(Window.get(this).getHeldItemStack())) {
|
||||
tooltip.add("Left click to assign gene");
|
||||
IGene existingGene = Engineering.getGene(Window.get(this).getHeldItemStack(), gene.getChromosome().ordinal());
|
||||
if (existingGene == null) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
String cName = Binnie.Genetics.getSystem(gene.getSpeciesRoot()).getChromosomeName(gene.getChromosome());
|
||||
tooltip.add(cName + ": " + gene.getName());
|
||||
if (isMouseOver() && canFill(Window.get(this).getHeldItemStack())) {
|
||||
tooltip.add("Left click to assign gene");
|
||||
IGene existingGene = Engineering.getGene(
|
||||
Window.get(this).getHeldItemStack(), gene.getChromosome().ordinal());
|
||||
if (existingGene == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String dName = Binnie.Genetics.getSystem(gene.getSpeciesRoot()).getChromosomeName(gene.getChromosome());
|
||||
tooltip.add("Will replace " + dName + ": " + existingGene.getName());
|
||||
}
|
||||
}
|
||||
String dName = Binnie.Genetics.getSystem(gene.getSpeciesRoot()).getChromosomeName(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());
|
||||
}
|
||||
private boolean canFill(ItemStack stack) {
|
||||
return stack != null
|
||||
&& stack.stackSize == 1
|
||||
&& Engineering.isGeneAcceptor(stack)
|
||||
&& Engineering.canAcceptGene(stack, getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGene getValue() {
|
||||
return gene;
|
||||
}
|
||||
@Override
|
||||
public IGene getValue() {
|
||||
return gene;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(IGene value) {
|
||||
gene = value;
|
||||
}
|
||||
@Override
|
||||
public void setValue(IGene value) {
|
||||
gene = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (isMouseOver() && canFill(Window.get(this).getHeldItemStack())) {
|
||||
CraftGUI.render.solid(getArea(), 0xffffffff);
|
||||
CraftGUI.render.solid(getArea().inset(1), 0xff444444);
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (isMouseOver() && canFill(Window.get(this).getHeldItemStack())) {
|
||||
CraftGUI.render.solid(getArea(), 0xffffffff);
|
||||
CraftGUI.render.solid(getArea().inset(1), 0xff444444);
|
||||
}
|
||||
|
||||
CraftGUI.render.color(0xffffffff);
|
||||
CraftGUI.render.iconItem(IPoint.ZERO, GeneticsTexture.dnaIcon.getIcon());
|
||||
}
|
||||
CraftGUI.render.color(0xffffffff);
|
||||
CraftGUI.render.iconItem(IPoint.ZERO, GeneticsTexture.dnaIcon.getIcon());
|
||||
}
|
||||
|
||||
private class MouseDownHandler extends EventMouse.Down.Handler {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
if (!canFill(Window.get(getWidget()).getHeldItemStack())) {
|
||||
return;
|
||||
}
|
||||
private class MouseDownHandler extends EventMouse.Down.Handler {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
if (!canFill(Window.get(getWidget()).getHeldItemStack())) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound action = new NBTTagCompound();
|
||||
NBTTagCompound geneNBT = new NBTTagCompound();
|
||||
getValue().writeToNBT(geneNBT);
|
||||
action.setTag("gene", geneNBT);
|
||||
Window.get(getWidget()).sendClientAction("gene-select", action);
|
||||
}
|
||||
}
|
||||
NBTTagCompound action = new NBTTagCompound();
|
||||
NBTTagCompound geneNBT = new NBTTagCompound();
|
||||
getValue().writeToNBT(geneNBT);
|
||||
action.setTag("gene", geneNBT);
|
||||
Window.get(getWidget()).sendClientAction("gene-select", action);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,75 +12,76 @@ import binnie.core.genetics.Gene;
|
||||
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;
|
||||
|
||||
public class ControlGeneScroll extends Control implements IControlValue<BreedingSystem> {
|
||||
private String filter;
|
||||
private BreedingSystem system;
|
||||
private String filter;
|
||||
private BreedingSystem system;
|
||||
|
||||
protected ControlGeneScroll(IWidget parent, float x, float y, float w, float h) {
|
||||
super(parent, x, y, w, h);
|
||||
filter = "";
|
||||
system = null;
|
||||
}
|
||||
protected ControlGeneScroll(IWidget parent, float x, float y, float w, float h) {
|
||||
super(parent, x, y, w, h);
|
||||
filter = "";
|
||||
system = null;
|
||||
}
|
||||
|
||||
public void setFilter(String filter) {
|
||||
this.filter = filter.toLowerCase();
|
||||
refresh();
|
||||
}
|
||||
public void setFilter(String filter) {
|
||||
this.filter = filter.toLowerCase();
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void setGenes(BreedingSystem system) {
|
||||
this.system = system;
|
||||
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(system.getSpeciesRoot());
|
||||
int x;
|
||||
int y = 0;
|
||||
boolean isNEI = ((WindowGeneBank) Window.get(this)).isNei;
|
||||
public void refresh() {
|
||||
deleteAllChildren();
|
||||
GeneTracker tracker = GeneTracker.getTracker(
|
||||
Window.get(this).getWorld(), Window.get(this).getUsername());
|
||||
Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(system.getSpeciesRoot());
|
||||
int x;
|
||||
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 : entry.getValue()) {
|
||||
Gene gene = new Gene(allele, entry.getKey(), system.getSpeciesRoot());
|
||||
if ((isNEI || tracker.isSequenced(new Gene(allele, entry.getKey(), system.getSpeciesRoot()))) && gene.getName().toLowerCase().contains(filter)) {
|
||||
discovered.add(allele);
|
||||
}
|
||||
}
|
||||
for (Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet()) {
|
||||
List<IAllele> discovered = new ArrayList<>();
|
||||
for (IAllele allele : entry.getValue()) {
|
||||
Gene gene = new Gene(allele, entry.getKey(), system.getSpeciesRoot());
|
||||
if ((isNEI || tracker.isSequenced(new Gene(allele, entry.getKey(), system.getSpeciesRoot())))
|
||||
&& gene.getName().toLowerCase().contains(filter)) {
|
||||
discovered.add(allele);
|
||||
}
|
||||
}
|
||||
|
||||
if (discovered.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
if (discovered.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
x = 0;
|
||||
new ControlText(this, new IPoint(x, y), system.getChromosomeName(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, entry.getKey(), system.getSpeciesRoot()));
|
||||
x += 18;
|
||||
}
|
||||
y += 24;
|
||||
}
|
||||
setSize(new IPoint(getSize().x(), y));
|
||||
}
|
||||
x = 0;
|
||||
new ControlText(this, new IPoint(x, y), system.getChromosomeName(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, entry.getKey(), system.getSpeciesRoot()));
|
||||
x += 18;
|
||||
}
|
||||
y += 24;
|
||||
}
|
||||
setSize(new IPoint(getSize().x(), y));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BreedingSystem getValue() {
|
||||
return system;
|
||||
}
|
||||
@Override
|
||||
public BreedingSystem getValue() {
|
||||
return system;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(BreedingSystem system) {
|
||||
setGenes(system);
|
||||
}
|
||||
@Override
|
||||
public void setValue(BreedingSystem system) {
|
||||
setGenes(system);
|
||||
}
|
||||
}
|
||||
@@ -9,56 +9,54 @@ import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlProgressBase;
|
||||
import binnie.core.craftgui.window.Panel;
|
||||
import binnie.core.machines.Machine;
|
||||
import java.util.Random;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ControlSequencerProgress extends ControlProgressBase {
|
||||
protected ControlText textControl;
|
||||
protected 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);
|
||||
textControl = new ControlText(panel, new IArea(4.0f, 4.0f, 92.0f, 44.0f), "", TextJustification.MIDDLE_CENTER);
|
||||
}
|
||||
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);
|
||||
textControl = new ControlText(panel, new IArea(4.0f, 4.0f, 92.0f, 44.0f), "", TextJustification.MIDDLE_CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateClient() {
|
||||
super.onUpdateClient();
|
||||
ItemStack stack = Machine.getMachine(Window.get(this).getInventory()).getMachineUtil().getStack(5);
|
||||
if (stack == null) {
|
||||
textControl.setValue("");
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void onUpdateClient() {
|
||||
super.onUpdateClient();
|
||||
ItemStack stack = Machine.getMachine(Window.get(this).getInventory())
|
||||
.getMachineUtil()
|
||||
.getStack(5);
|
||||
if (stack == null) {
|
||||
textControl.setValue("");
|
||||
return;
|
||||
}
|
||||
|
||||
Random rand = new Random(stack.getDisplayName().length());
|
||||
StringBuilder text = new StringBuilder();
|
||||
String[] codes = {"A", "T", "G", "C"};
|
||||
EnumChatFormatting[] colors = {
|
||||
EnumChatFormatting.GREEN,
|
||||
EnumChatFormatting.LIGHT_PURPLE,
|
||||
EnumChatFormatting.AQUA,
|
||||
EnumChatFormatting.RED
|
||||
};
|
||||
Random rand = new Random(stack.getDisplayName().length());
|
||||
StringBuilder text = new StringBuilder();
|
||||
String[] codes = {"A", "T", "G", "C"};
|
||||
EnumChatFormatting[] colors = {
|
||||
EnumChatFormatting.GREEN, EnumChatFormatting.LIGHT_PURPLE, EnumChatFormatting.AQUA, EnumChatFormatting.RED
|
||||
};
|
||||
|
||||
for (int i = 0; i < 65; ++i) {
|
||||
int k = rand.nextInt(4);
|
||||
String code = codes[k];
|
||||
if (rand.nextFloat() < progress) {
|
||||
String col = colors[k].toString();
|
||||
text.append(EnumChatFormatting.RESET)
|
||||
.append(col)
|
||||
.append(EnumChatFormatting.BOLD)
|
||||
.append(code);
|
||||
} else {
|
||||
text.append(EnumChatFormatting.RESET)
|
||||
.append(EnumChatFormatting.GRAY)
|
||||
.append(EnumChatFormatting.OBFUSCATED)
|
||||
.append(EnumChatFormatting.BOLD)
|
||||
.append(code);
|
||||
}
|
||||
}
|
||||
textControl.setValue(text.toString());
|
||||
}
|
||||
for (int i = 0; i < 65; ++i) {
|
||||
int k = rand.nextInt(4);
|
||||
String code = codes[k];
|
||||
if (rand.nextFloat() < progress) {
|
||||
String col = colors[k].toString();
|
||||
text.append(EnumChatFormatting.RESET)
|
||||
.append(col)
|
||||
.append(EnumChatFormatting.BOLD)
|
||||
.append(code);
|
||||
} else {
|
||||
text.append(EnumChatFormatting.RESET)
|
||||
.append(EnumChatFormatting.GRAY)
|
||||
.append(EnumChatFormatting.OBFUSCATED)
|
||||
.append(EnumChatFormatting.BOLD)
|
||||
.append(code);
|
||||
}
|
||||
}
|
||||
textControl.setValue(text.toString());
|
||||
}
|
||||
}
|
||||
@@ -6,47 +6,52 @@ import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.minecraft.control.ControlProgressBase;
|
||||
|
||||
public class ControlSplicerProgress extends ControlProgressBase {
|
||||
float strength;
|
||||
float strength;
|
||||
|
||||
public ControlSplicerProgress(IWidget parent, float x, float y, float w, float h) {
|
||||
super(parent, x, y, w, h);
|
||||
strength = 0.0f;
|
||||
strength = 0.0f;
|
||||
}
|
||||
public ControlSplicerProgress(IWidget parent, float x, float y, float w, float h) {
|
||||
super(parent, x, y, w, h);
|
||||
strength = 0.0f;
|
||||
strength = 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
@Override
|
||||
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 = {0x990000, 0x007700, 0x0000ff, 0x997700};
|
||||
int c1 = colours[(int) Math.abs(13.0 * Math.sin(i) + 48.0 * Math.cos(i) + 25.0 * Math.sin(7 * i)) % 4];
|
||||
int c2 = colours[(int) Math.abs(23.0 * Math.sin(i) + 28.0 * Math.cos(i) + 15.0 * Math.sin(7 * i)) % 4];
|
||||
int c3 = colours[(int) Math.abs(43.0 * Math.sin(i) + 38.0 * Math.cos(i) + 55.0 * Math.sin(7 * i)) % 4];
|
||||
int c4 = colours[(int) Math.abs(3.0 * Math.sin(i) + 18.0 * Math.cos(i) + 35.0 * Math.sin(7 * i)) % 4];
|
||||
float y = oy + i * spacing;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
int seed = 432523;
|
||||
int[] colours = {0x990000, 0x007700, 0x0000ff, 0x997700};
|
||||
int c1 = colours[(int) Math.abs(13.0 * Math.sin(i) + 48.0 * Math.cos(i) + 25.0 * Math.sin(7 * i)) % 4];
|
||||
int c2 = colours[(int) Math.abs(23.0 * Math.sin(i) + 28.0 * Math.cos(i) + 15.0 * Math.sin(7 * i)) % 4];
|
||||
int c3 = colours[(int) Math.abs(43.0 * Math.sin(i) + 38.0 * Math.cos(i) + 55.0 * Math.sin(7 * i)) % 4];
|
||||
int c4 = colours[(int) Math.abs(3.0 * Math.sin(i) + 18.0 * Math.cos(i) + 35.0 * 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,45 +19,46 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowAcclimatiser extends WindowMachine {
|
||||
protected static Texture progressBase = new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
protected static Texture progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
protected static Texture progressBase =
|
||||
new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
protected static Texture progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
|
||||
public WindowAcclimatiser(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(280, 198, player, inventory, side);
|
||||
}
|
||||
public WindowAcclimatiser(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(280, 198, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowAcclimatiser(player, inventory, side);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowAcclimatiser(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
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(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 ControlErrorState(this, 181.0f, 83.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
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(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 ControlErrorState(this, 181.0f, 83.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.labMachine.acclimatiser");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.labMachine.acclimatiser");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Acclimatiser";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Acclimatiser";
|
||||
}
|
||||
}
|
||||
@@ -26,54 +26,55 @@ 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);
|
||||
}
|
||||
public WindowAnalyser(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(220, 210, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowAnalyser(player, inventory, side);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowAnalyser(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
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 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(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);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
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 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(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);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.labMachine.analyser");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.labMachine.analyser");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Analyser";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Analyser";
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,9 @@ 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.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -34,153 +37,164 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WindowGeneBank extends WindowMachine {
|
||||
public boolean isNei;
|
||||
public boolean isNei;
|
||||
|
||||
protected ControlGeneScroll genes;
|
||||
protected ControlGeneScroll genes;
|
||||
|
||||
public WindowGeneBank(EntityPlayer player, IInventory inventory, Side side, boolean isNEI) {
|
||||
super(320, 224, player, inventory, side);
|
||||
isNei = isNEI;
|
||||
}
|
||||
public WindowGeneBank(EntityPlayer player, IInventory inventory, Side side, boolean isNEI) {
|
||||
super(320, 224, player, inventory, side);
|
||||
isNei = isNEI;
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowGeneBank(player, inventory, side, false);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowGeneBank(player, inventory, side, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||
super.recieveGuiNBT(side, player, name, nbt);
|
||||
if (side != Side.SERVER || !name.equals("gene-select")) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||
super.recieveGuiNBT(side, player, name, nbt);
|
||||
if (side != Side.SERVER || !name.equals("gene-select")) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gene gene = new Gene(nbt.getCompoundTag("gene"));
|
||||
if (gene.isCorrupted()) {
|
||||
return;
|
||||
}
|
||||
Gene gene = new Gene(nbt.getCompoundTag("gene"));
|
||||
if (gene.isCorrupted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseServer() {
|
||||
GeneTracker tracker = GeneTracker.getTracker(getWorld(), getUsername());
|
||||
if (tracker != null) {
|
||||
tracker.synchToPlayer(getPlayer());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void initialiseServer() {
|
||||
GeneTracker tracker = GeneTracker.getTracker(getWorld(), getUsername());
|
||||
if (tracker != null) {
|
||||
tracker.synchToPlayer(getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle(getTitle());
|
||||
addEventHandler(new EventValueChanged.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventValueChanged event) {
|
||||
if (event.value instanceof BreedingSystem) {
|
||||
genes.setValue((BreedingSystem) event.value);
|
||||
}
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle(getTitle());
|
||||
addEventHandler(new EventValueChanged.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventValueChanged event) {
|
||||
if (event.value instanceof BreedingSystem) {
|
||||
genes.setValue((BreedingSystem) event.value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
int boxX;
|
||||
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() {
|
||||
@Override
|
||||
public void onEvent(EventTextEdit event) {
|
||||
genes.setFilter(event.getValue());
|
||||
}
|
||||
}.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) {
|
||||
@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) {
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(getValue().toString());
|
||||
int totalGenes = 0;
|
||||
int seqGenes = 0;
|
||||
GeneTracker tracker = GeneTracker.getTracker(getWorld(), getUsername());
|
||||
Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(getValue().getSpeciesRoot());
|
||||
for (Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet()) {
|
||||
totalGenes += entry.getValue().size();
|
||||
for (IAllele allele : entry.getValue()) {
|
||||
Gene gene = new Gene(allele, entry.getKey(), getValue().getSpeciesRoot());
|
||||
if (tracker.isSequenced(gene)) {
|
||||
seqGenes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
tooltip.add(I18N.localise("genetics.gui.geneBank.sequencedGenes.short", seqGenes, totalGenes));
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
int boxX;
|
||||
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() {
|
||||
@Override
|
||||
public void onEvent(EventTextEdit event) {
|
||||
genes.setFilter(event.getValue());
|
||||
}
|
||||
}.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) {
|
||||
@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) {
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(getValue().toString());
|
||||
int totalGenes = 0;
|
||||
int seqGenes = 0;
|
||||
GeneTracker tracker = GeneTracker.getTracker(getWorld(), getUsername());
|
||||
Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(
|
||||
getValue().getSpeciesRoot());
|
||||
for (Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet()) {
|
||||
totalGenes += entry.getValue().size();
|
||||
for (IAllele allele : entry.getValue()) {
|
||||
Gene gene = new Gene(
|
||||
allele,
|
||||
entry.getKey(),
|
||||
getValue().getSpeciesRoot());
|
||||
if (tracker.isSequenced(gene)) {
|
||||
seqGenes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
tooltip.add(I18N.localise(
|
||||
"genetics.gui.geneBank.sequencedGenes.short", seqGenes, totalGenes));
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
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(
|
||||
I18N.localise("genetics.gui.geneBank.stats"),
|
||||
I18N.localise("genetics.gui.geneBank.ranking")
|
||||
));
|
||||
infoTabs.setValue(I18N.localise("genetics.gui.geneBank.info"));
|
||||
Panel panelProject = new Panel(this, boxX + 24, 160.0f, geneBoxWidth + 20, 50.0f, MinecraftGUI.PanelType.Black);
|
||||
int totalGenes = 0;
|
||||
int seqGenes = 0;
|
||||
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(
|
||||
I18N.localise("genetics.gui.geneBank.stats"), I18N.localise("genetics.gui.geneBank.ranking")));
|
||||
infoTabs.setValue(I18N.localise("genetics.gui.geneBank.info"));
|
||||
Panel panelProject = new Panel(this, boxX + 24, 160.0f, geneBoxWidth + 20, 50.0f, MinecraftGUI.PanelType.Black);
|
||||
int totalGenes = 0;
|
||||
int seqGenes = 0;
|
||||
|
||||
for (BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
|
||||
GeneTracker tracker = GeneTracker.getTracker(getWorld(), getUsername());
|
||||
Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(system.getSpeciesRoot());
|
||||
for (Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet()) {
|
||||
totalGenes += entry.getValue().size();
|
||||
for (IAllele allele : entry.getValue()) {
|
||||
Gene gene = new Gene(allele, entry.getKey(), system.getSpeciesRoot());
|
||||
if (tracker.isSequenced(gene)) {
|
||||
++seqGenes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
|
||||
GeneTracker tracker = GeneTracker.getTracker(getWorld(), getUsername());
|
||||
Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(system.getSpeciesRoot());
|
||||
for (Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet()) {
|
||||
totalGenes += entry.getValue().size();
|
||||
for (IAllele allele : entry.getValue()) {
|
||||
Gene gene = new Gene(allele, entry.getKey(), system.getSpeciesRoot());
|
||||
if (tracker.isSequenced(gene)) {
|
||||
++seqGenes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new ControlText(panelProject, new IPoint(4.0f, 4.0f), EnumChatFormatting.UNDERLINE + I18N.localise("genetics.gui.geneBank.project"));
|
||||
new ControlText(panelProject, new IPoint(4.0f, 18.0f), EnumChatFormatting.ITALIC.toString() + EnumChatFormatting.YELLOW + I18N.localise("genetics.gui.geneBank.sequencedGenes", seqGenes, totalGenes));
|
||||
}
|
||||
new ControlText(
|
||||
panelProject,
|
||||
new IPoint(4.0f, 4.0f),
|
||||
EnumChatFormatting.UNDERLINE + I18N.localise("genetics.gui.geneBank.project"));
|
||||
new ControlText(
|
||||
panelProject,
|
||||
new IPoint(4.0f, 18.0f),
|
||||
EnumChatFormatting.ITALIC.toString()
|
||||
+ EnumChatFormatting.YELLOW
|
||||
+ I18N.localise("genetics.gui.geneBank.sequencedGenes", seqGenes, totalGenes));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.geneBank");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.geneBank");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "GeneBank";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "GeneBank";
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ 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);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowGeneBank(player, inventory, side, true);
|
||||
}
|
||||
}
|
||||
@@ -24,57 +24,57 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowGenepool extends WindowMachine {
|
||||
static Texture progressBase = new StandardTexture(64, 0, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
static Texture progress = new StandardTexture(64, 21, 130, 21, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
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 WindowGenepool(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(280, 198, player, inventory, side);
|
||||
}
|
||||
public WindowGenepool(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(280, 198, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowGenepool(player, inventory, side);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowGenepool(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(Genepool.TANK_ETHANOL);
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(Genepool.TANK_ETHANOL);
|
||||
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Genepool.SLOT_RESERVE);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Genepool.SLOT_RESERVE);
|
||||
|
||||
x += 38;
|
||||
new ControlIconDisplay(this, x, y + 22, GUIIcon.ArrowRight.getIcon());
|
||||
x += 38;
|
||||
new ControlIconDisplay(this, x, y + 22, GUIIcon.ArrowRight.getIcon());
|
||||
|
||||
x += 18;
|
||||
new ControlSlot(this, x, y + 21).assign(Genepool.SLOT_BEE);
|
||||
x += 18;
|
||||
new ControlSlot(this, x, y + 21).assign(Genepool.SLOT_BEE);
|
||||
|
||||
x += 18;
|
||||
new ControlMachineProgress(this, x, y + 19, progressBase, progress, Position.LEFT);
|
||||
x += 18;
|
||||
new ControlMachineProgress(this, x, y + 19, progressBase, progress, Position.LEFT);
|
||||
|
||||
x += 130;
|
||||
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);
|
||||
}
|
||||
x += 130;
|
||||
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 I18N.localise("genetics.machine.labMachine.genepool");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.labMachine.genepool");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Genepool";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Genepool";
|
||||
}
|
||||
}
|
||||
@@ -23,54 +23,55 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowIncubator extends WindowMachine {
|
||||
protected static Texture progressBase = new StandardTexture(0, 91, 38, 32, GeneticsTexture.GUIProcess);
|
||||
protected static Texture progress = new StandardTexture(38, 91, 38, 32, GeneticsTexture.GUIProcess);
|
||||
protected static Texture progressBase = new StandardTexture(0, 91, 38, 32, GeneticsTexture.GUIProcess);
|
||||
protected static Texture progress = new StandardTexture(38, 91, 38, 32, GeneticsTexture.GUIProcess);
|
||||
|
||||
public WindowIncubator(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(228, 196, player, inventory, side);
|
||||
}
|
||||
public WindowIncubator(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(228, 196, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowIncubator(player, inventory, side);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowIncubator(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(Incubator.TANK_INPUT);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_QUEUE);
|
||||
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 ControlSlot(this, x + 10, y + 3 + 10).assign(Incubator.SLOT_INCUBATOR);
|
||||
x += 40;
|
||||
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon());
|
||||
x += 18;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_OUTPUT);
|
||||
x += 26;
|
||||
new ControlLiquidTank(this, x, y).setTankID(Incubator.TANK_OUTPUT);
|
||||
x += 34;
|
||||
new ControlEnergyBar(this, x, y + 3, 16, 54, Position.BOTTOM);
|
||||
new ControlErrorState(this, 91.0f, 82.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(Incubator.TANK_INPUT);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_QUEUE);
|
||||
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 ControlSlot(this, x + 10, y + 3 + 10).assign(Incubator.SLOT_INCUBATOR);
|
||||
x += 40;
|
||||
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon());
|
||||
x += 18;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_OUTPUT);
|
||||
x += 26;
|
||||
new ControlLiquidTank(this, x, y).setTankID(Incubator.TANK_OUTPUT);
|
||||
x += 34;
|
||||
new ControlEnergyBar(this, x, y + 3, 16, 54, Position.BOTTOM);
|
||||
new ControlErrorState(this, 91.0f, 82.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.labMachine.incubator");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.labMachine.incubator");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Incubator";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Incubator";
|
||||
}
|
||||
}
|
||||
@@ -25,47 +25,62 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowInoculator extends WindowMachine {
|
||||
static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2.getTexture());
|
||||
static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2.getTexture());
|
||||
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 WindowInoculator(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(266, 240, player, inventory, side);
|
||||
}
|
||||
public WindowInoculator(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(266, 240, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowInoculator(player, inventory, side);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowInoculator(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
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 ControlErrorState(this, 161.0f, 118.0f);
|
||||
x += 142;
|
||||
CraftGUIUtil.verticalGrid(x, y, TextJustification.MIDDLE_LEFT, 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));
|
||||
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);
|
||||
}
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
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 ControlErrorState(this, 161.0f, 118.0f);
|
||||
x += 142;
|
||||
CraftGUIUtil.verticalGrid(
|
||||
x,
|
||||
y,
|
||||
TextJustification.MIDDLE_LEFT,
|
||||
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));
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.machine.inoculator");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.machine.inoculator");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Inoculator";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Inoculator";
|
||||
}
|
||||
}
|
||||
@@ -24,58 +24,58 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowIsolator extends WindowMachine {
|
||||
static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
static Texture Progress = new StandardTexture(0, 201, 142, 17, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
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 WindowIsolator(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(330, 208, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowIsolator(player, inventory, side);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowIsolator(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(Isolator.TANK_ETHANOL);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Isolator.SLOT_RESERVE);
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon());
|
||||
x += 18;
|
||||
new ControlSlot(this, x, y + 3).assign(Isolator.SLOT_TARGET);
|
||||
new ControlSlot(this, x, y + 36 + 3).assign(Isolator.SLOT_ENZYME);
|
||||
new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColor(0xefe8af);
|
||||
x += 18;
|
||||
new ControlProgress(this, x, y + 3, WindowIsolator.ProgressBase, WindowIsolator.Progress, Position.LEFT);
|
||||
x += 142;
|
||||
new ControlSlot(this, x, y + 3).assign(Isolator.SLOT_RESULT);
|
||||
new ControlSlot(this, x, y + 3 + 36).assign(Isolator.SLOT_SEQUENCER_VIAL);
|
||||
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.SLOT_FINISHED);
|
||||
new ControlEnergyBar(this, 260, 130, 16, 60, Position.BOTTOM);
|
||||
new ControlErrorState(this, 153.0f, 81.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(Isolator.TANK_ETHANOL);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Isolator.SLOT_RESERVE);
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon());
|
||||
x += 18;
|
||||
new ControlSlot(this, x, y + 3).assign(Isolator.SLOT_TARGET);
|
||||
new ControlSlot(this, x, y + 36 + 3).assign(Isolator.SLOT_ENZYME);
|
||||
new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColor(0xefe8af);
|
||||
x += 18;
|
||||
new ControlProgress(this, x, y + 3, WindowIsolator.ProgressBase, WindowIsolator.Progress, Position.LEFT);
|
||||
x += 142;
|
||||
new ControlSlot(this, x, y + 3).assign(Isolator.SLOT_RESULT);
|
||||
new ControlSlot(this, x, y + 3 + 36).assign(Isolator.SLOT_SEQUENCER_VIAL);
|
||||
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.SLOT_FINISHED);
|
||||
new ControlEnergyBar(this, 260, 130, 16, 60, Position.BOTTOM);
|
||||
new ControlErrorState(this, 153.0f, 81.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.machine.isolator");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.machine.isolator");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Isolator";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Isolator";
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,14 @@ 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 WindowMachine(int width, int height, EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(width, height, player, inventory, side);
|
||||
}
|
||||
|
||||
public abstract String getTitle();
|
||||
public abstract String getTitle();
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle(getTitle());
|
||||
}
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
setTitle(getTitle());
|
||||
}
|
||||
}
|
||||
@@ -24,51 +24,52 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowPolymeriser extends WindowMachine {
|
||||
protected static Texture progressBase = new StandardTexture(76, 170, 160, 79, GeneticsTexture.GUIProcess.getTexture());
|
||||
protected static Texture progress = new StandardTexture(76, 91, 160, 79, GeneticsTexture.GUIProcess.getTexture());
|
||||
protected static Texture progressBase =
|
||||
new StandardTexture(76, 170, 160, 79, GeneticsTexture.GUIProcess.getTexture());
|
||||
protected static Texture progress = new StandardTexture(76, 91, 160, 79, GeneticsTexture.GUIProcess.getTexture());
|
||||
|
||||
public WindowPolymeriser(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(278, 212, player, inventory, side);
|
||||
}
|
||||
public WindowPolymeriser(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(278, 212, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowPolymeriser(player, inventory, side);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowPolymeriser(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 38;
|
||||
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, progressBase, progress, Position.LEFT);
|
||||
new ControlSlot(this, x, y).assign(Polymeriser.SLOT_SERUM);
|
||||
new ControlLiquidTank(this, x, y + 18 + 16, true).setTankID(Polymeriser.TANK_BACTERIA);
|
||||
new ControlLiquidTank(this, x, y + 18 + 16 + 18 + 8, true).setTankID(Polymeriser.TANK_DNA);
|
||||
new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.LEFT);
|
||||
x += 40;
|
||||
new ControlSlot(this, x + 30, y + 18 + 8).assign(Polymeriser.SLOT_GOLD);
|
||||
new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColor(0xffd800);
|
||||
x += 138;
|
||||
new ControlSlotArray(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED);
|
||||
new ControlErrorState(this, 244.0f, 97.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 38;
|
||||
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, progressBase, progress, Position.LEFT);
|
||||
new ControlSlot(this, x, y).assign(Polymeriser.SLOT_SERUM);
|
||||
new ControlLiquidTank(this, x, y + 18 + 16, true).setTankID(Polymeriser.TANK_BACTERIA);
|
||||
new ControlLiquidTank(this, x, y + 18 + 16 + 18 + 8, true).setTankID(Polymeriser.TANK_DNA);
|
||||
new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.LEFT);
|
||||
x += 40;
|
||||
new ControlSlot(this, x + 30, y + 18 + 8).assign(Polymeriser.SLOT_GOLD);
|
||||
new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColor(0xffd800);
|
||||
x += 138;
|
||||
new ControlSlotArray(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED);
|
||||
new ControlErrorState(this, 244.0f, 97.0f);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.machine.polymeriser");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.machine.polymeriser");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Polymeriser";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Polymeriser";
|
||||
}
|
||||
}
|
||||
@@ -28,65 +28,77 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class WindowSequencer extends WindowMachine {
|
||||
protected static Texture progressBase = new StandardTexture(64, 114, 98, 9, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
protected static Texture progress = new StandardTexture(64, 123, 98, 9, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
protected static Texture progressBase =
|
||||
new StandardTexture(64, 114, 98, 9, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
protected static Texture progress = new StandardTexture(64, 123, 98, 9, ExtraBeeTexture.GUIProgress.getTexture());
|
||||
|
||||
protected ControlText slotText;
|
||||
protected ControlText slotText;
|
||||
|
||||
public WindowSequencer(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(226, 224, player, inventory, side);
|
||||
}
|
||||
public WindowSequencer(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(226, 224, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowSequencer(player, inventory, side);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowSequencer(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||
if (side == Side.CLIENT && name.equals("username")) {
|
||||
slotText.setValue(
|
||||
EnumChatFormatting.DARK_GRAY
|
||||
+ I18N.localise("genetics.machine.sequencer.gui.sequensedBy", nbt.getString("username"))
|
||||
);
|
||||
}
|
||||
super.recieveGuiNBT(side, player, name, nbt);
|
||||
}
|
||||
@Override
|
||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||
if (side == Side.CLIENT && name.equals("username")) {
|
||||
slotText.setValue(EnumChatFormatting.DARK_GRAY
|
||||
+ I18N.localise("genetics.machine.sequencer.gui.sequensedBy", nbt.getString("username")));
|
||||
}
|
||||
super.recieveGuiNBT(side, player, name, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
CraftGUIUtil.horizontalGrid(x, y, TextJustification.MIDDLE_CENTER, 2.0f, new ControlSlotArray(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE), 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;
|
||||
slotText = new ControlText(this, new IArea(0.0f, y, w(), 12.0f), EnumChatFormatting.DARK_GRAY + I18N.localise("genetics.machine.sequencer.gui.willNotSave"), TextJustification.MIDDLE_CENTER);
|
||||
y += 20;
|
||||
ControlSlot slotDye = new ControlSlot(this, x, y);
|
||||
slotDye.assign(0);
|
||||
x += 20;
|
||||
new ControlSlotCharge(this, x, y, 0).setColor(16750848);
|
||||
x += 32;
|
||||
new ControlEnergyBar(this, x, y, 60, 16, Position.LEFT);
|
||||
x += 92;
|
||||
new ControlErrorState(this, x, y + 1);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
CraftGUIUtil.horizontalGrid(
|
||||
x,
|
||||
y,
|
||||
TextJustification.MIDDLE_CENTER,
|
||||
2.0f,
|
||||
new ControlSlotArray(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE),
|
||||
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;
|
||||
slotText = new ControlText(
|
||||
this,
|
||||
new IArea(0.0f, y, w(), 12.0f),
|
||||
EnumChatFormatting.DARK_GRAY + I18N.localise("genetics.machine.sequencer.gui.willNotSave"),
|
||||
TextJustification.MIDDLE_CENTER);
|
||||
y += 20;
|
||||
ControlSlot slotDye = new ControlSlot(this, x, y);
|
||||
slotDye.assign(0);
|
||||
x += 20;
|
||||
new ControlSlotCharge(this, x, y, 0).setColor(16750848);
|
||||
x += 32;
|
||||
new ControlEnergyBar(this, x, y, 60, 16, Position.LEFT);
|
||||
x += 92;
|
||||
new ControlErrorState(this, x, y + 1);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.machine.sequencer");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.machine.sequencer");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Sequencer";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Sequencer";
|
||||
}
|
||||
}
|
||||
@@ -24,64 +24,58 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowSplicer extends WindowMachine {
|
||||
protected static Texture progressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2.getTexture());
|
||||
protected static Texture progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2.getTexture());
|
||||
protected static Texture progressBase =
|
||||
new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2.getTexture());
|
||||
protected static Texture progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2.getTexture());
|
||||
|
||||
public WindowSplicer(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(280, 240, player, inventory, side);
|
||||
}
|
||||
public WindowSplicer(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(280, 240, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowSplicer(player, inventory, side);
|
||||
}
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowSplicer(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
new ControlSplicerProgress(this, 84.0f, 32.0f, w() - 172.0f, 102.0f);
|
||||
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(Splicer.SLOT_SERUM_VIAL)
|
||||
);
|
||||
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 ControlErrorState(this, 218.0f, 86.0f);
|
||||
CraftGUIUtil.verticalGrid(
|
||||
(w() - 72.0f) / 2.0f,
|
||||
32.0f,
|
||||
TextJustification.MIDDLE_CENTER,
|
||||
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(Splicer.SLOT_TARGET),
|
||||
new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowDown.getIcon()),
|
||||
new ControlSlotArray(this, 0, 0, 4, 1)
|
||||
.create(Inoculator.SLOT_FINISHED));
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
new ControlSplicerProgress(this, 84.0f, 32.0f, w() - 172.0f, 102.0f);
|
||||
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(Splicer.SLOT_SERUM_VIAL));
|
||||
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 ControlErrorState(this, 218.0f, 86.0f);
|
||||
CraftGUIUtil.verticalGrid(
|
||||
(w() - 72.0f) / 2.0f,
|
||||
32.0f,
|
||||
TextJustification.MIDDLE_CENTER,
|
||||
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(Splicer.SLOT_TARGET),
|
||||
new ControlIconDisplay(this, 0.0f, 0.0f, GUIIcon.ArrowDown.getIcon()),
|
||||
new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_FINISHED));
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.advMachine.splicer");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.machine.advMachine.splicer");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Splicer";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Splicer";
|
||||
}
|
||||
}
|
||||
@@ -11,209 +11,208 @@ import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
import java.util.Locale;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper {
|
||||
public static IAllele getAllele(EnumTemperature temperature) {
|
||||
return getAllele(getUid(temperature));
|
||||
}
|
||||
public static IAllele getAllele(EnumTemperature temperature) {
|
||||
return getAllele(getUid(temperature));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumHumidity humidity) {
|
||||
return getAllele(getUid(humidity));
|
||||
}
|
||||
public static IAllele getAllele(EnumHumidity humidity) {
|
||||
return getAllele(getUid(humidity));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumTolerance tolerance) {
|
||||
return getAllele(getUid(tolerance));
|
||||
}
|
||||
public static IAllele getAllele(EnumTolerance tolerance) {
|
||||
return getAllele(getUid(tolerance));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumAllele.Fertility fertility) {
|
||||
return getAllele(getUid(fertility));
|
||||
}
|
||||
public static IAllele getAllele(EnumAllele.Fertility fertility) {
|
||||
return getAllele(getUid(fertility));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumAllele.Territory territory) {
|
||||
return getAllele(getUid(territory));
|
||||
}
|
||||
public static IAllele getAllele(EnumAllele.Territory territory) {
|
||||
return getAllele(getUid(territory));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumAllele.Lifespan lifespan) {
|
||||
return getAllele(getUid(lifespan));
|
||||
}
|
||||
public static IAllele getAllele(EnumAllele.Lifespan lifespan) {
|
||||
return getAllele(getUid(lifespan));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumAllele.Sappiness sappiness) {
|
||||
return getAllele(getUid(sappiness));
|
||||
}
|
||||
public static IAllele getAllele(EnumAllele.Sappiness sappiness) {
|
||||
return getAllele(getUid(sappiness));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumAllele.Speed speed) {
|
||||
return getAllele(getUid(speed));
|
||||
}
|
||||
public static IAllele getAllele(EnumAllele.Speed speed) {
|
||||
return getAllele(getUid(speed));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumAllele.Flowering flowering) {
|
||||
return getAllele(getUid(flowering));
|
||||
}
|
||||
public static IAllele getAllele(EnumAllele.Flowering flowering) {
|
||||
return getAllele(getUid(flowering));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumAllele.Height height) {
|
||||
return getAllele(getUid(height));
|
||||
}
|
||||
public static IAllele getAllele(EnumAllele.Height height) {
|
||||
return getAllele(getUid(height));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumAllele.Maturation maturation) {
|
||||
return getAllele(getUid(maturation));
|
||||
}
|
||||
public static IAllele getAllele(EnumAllele.Maturation maturation) {
|
||||
return getAllele(getUid(maturation));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumAllele.Yield yield) {
|
||||
return getAllele(getUid(yield));
|
||||
}
|
||||
public static IAllele getAllele(EnumAllele.Yield yield) {
|
||||
return getAllele(getUid(yield));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumAllele.Saplings saplings) {
|
||||
return getAllele(getUid(saplings));
|
||||
}
|
||||
public static IAllele getAllele(EnumAllele.Saplings saplings) {
|
||||
return getAllele(getUid(saplings));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumFlowerColor color) {
|
||||
return color.getAllele();
|
||||
}
|
||||
public static IAllele getAllele(EnumFlowerColor color) {
|
||||
return color.getAllele();
|
||||
}
|
||||
|
||||
public static IAllele getAllele(int number) {
|
||||
return getAllele("forestry.i" + number + "d");
|
||||
}
|
||||
public static IAllele getAllele(int number) {
|
||||
return getAllele("forestry.i" + number + "d");
|
||||
}
|
||||
|
||||
public static IAllele getAllele(boolean bool) {
|
||||
if (bool) {
|
||||
return getAllele("forestry.boolTrue");
|
||||
}
|
||||
return getAllele("forestry.boolFalse");
|
||||
}
|
||||
public static IAllele getAllele(boolean bool) {
|
||||
if (bool) {
|
||||
return getAllele("forestry.boolTrue");
|
||||
}
|
||||
return getAllele("forestry.boolFalse");
|
||||
}
|
||||
|
||||
public static IAllele getAllele(String uid) {
|
||||
return AlleleManager.alleleRegistry.getAllele(uid);
|
||||
}
|
||||
public static IAllele getAllele(String uid) {
|
||||
return AlleleManager.alleleRegistry.getAllele(uid);
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumTemperature temperature) {
|
||||
return AlleleManager.climateHelper.toDisplay(temperature);
|
||||
}
|
||||
public static String toDisplay(EnumTemperature temperature) {
|
||||
return AlleleManager.climateHelper.toDisplay(temperature);
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumHumidity humidity) {
|
||||
return AlleleManager.climateHelper.toDisplay(humidity);
|
||||
}
|
||||
public static String toDisplay(EnumHumidity humidity) {
|
||||
return AlleleManager.climateHelper.toDisplay(humidity);
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumMoisture moisture) {
|
||||
return I18N.localise("botany.moisture." + moisture.getID());
|
||||
}
|
||||
public static String toDisplay(EnumMoisture moisture) {
|
||||
return I18N.localise("botany.moisture." + moisture.getID());
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumAcidity acidity) {
|
||||
return I18N.localise("botany.ph." + acidity.getID());
|
||||
}
|
||||
public static String toDisplay(EnumAcidity acidity) {
|
||||
return I18N.localise("botany.ph." + acidity.getID());
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumSoilType soilType) {
|
||||
return I18N.localise("botany.soil." + soilType.getID());
|
||||
}
|
||||
public static String toDisplay(EnumSoilType soilType) {
|
||||
return I18N.localise("botany.soil." + soilType.getID());
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumTolerance tolerance) {
|
||||
return toAlleleDisplay("tolerance", tolerance.name());
|
||||
}
|
||||
public static String toDisplay(EnumTolerance tolerance) {
|
||||
return toAlleleDisplay("tolerance", tolerance.name());
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumAllele.Flowering flowering) {
|
||||
if (flowering == EnumAllele.Flowering.AVERAGE) {
|
||||
return toAlleleDisplay("flowering", "normal");
|
||||
}
|
||||
return toAlleleDisplay(null, flowering.name());
|
||||
}
|
||||
public static String toDisplay(EnumAllele.Flowering flowering) {
|
||||
if (flowering == EnumAllele.Flowering.AVERAGE) {
|
||||
return toAlleleDisplay("flowering", "normal");
|
||||
}
|
||||
return toAlleleDisplay(null, flowering.name());
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumAllele.Speed speed) {
|
||||
return toAlleleDisplay(null, speed.name());
|
||||
}
|
||||
public static String toDisplay(EnumAllele.Speed speed) {
|
||||
return toAlleleDisplay(null, speed.name());
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumAllele.Lifespan lifespan) {
|
||||
return toAlleleDisplay("lifespan", lifespan.name());
|
||||
}
|
||||
public static String toDisplay(EnumAllele.Lifespan lifespan) {
|
||||
return toAlleleDisplay("lifespan", lifespan.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Fertility fertility) {
|
||||
return getUid("fertility", fertility.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Fertility fertility) {
|
||||
return getUid("fertility", fertility.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Lifespan lifespan) {
|
||||
return getUid("lifespan", lifespan.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Lifespan lifespan) {
|
||||
return getUid("lifespan", lifespan.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Sappiness sappiness) {
|
||||
return getUid("sappiness", sappiness.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Sappiness sappiness) {
|
||||
return getUid("sappiness", sappiness.name());
|
||||
}
|
||||
|
||||
private static String getUid(EnumTemperature temperature) {
|
||||
return getUid("temperature", temperature.name());
|
||||
}
|
||||
private static String getUid(EnumTemperature temperature) {
|
||||
return getUid("temperature", temperature.name());
|
||||
}
|
||||
|
||||
private static String getUid(EnumHumidity humidity) {
|
||||
return getUid("humidity", humidity.name());
|
||||
}
|
||||
private static String getUid(EnumHumidity humidity) {
|
||||
return getUid("humidity", humidity.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Saplings saplings) {
|
||||
if (saplings == EnumAllele.Saplings.AVERAGE) {
|
||||
return getUid("saplings", "Default");
|
||||
}
|
||||
if (saplings == EnumAllele.Saplings.HIGH) {
|
||||
return getUid("saplings", "Double");
|
||||
}
|
||||
if (saplings == EnumAllele.Saplings.HIGHER) {
|
||||
return getUid("saplings", "Triple");
|
||||
}
|
||||
return getUid("saplings", saplings.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Saplings saplings) {
|
||||
if (saplings == EnumAllele.Saplings.AVERAGE) {
|
||||
return getUid("saplings", "Default");
|
||||
}
|
||||
if (saplings == EnumAllele.Saplings.HIGH) {
|
||||
return getUid("saplings", "Double");
|
||||
}
|
||||
if (saplings == EnumAllele.Saplings.HIGHER) {
|
||||
return getUid("saplings", "Triple");
|
||||
}
|
||||
return getUid("saplings", saplings.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Height height) {
|
||||
if (height == EnumAllele.Height.AVERAGE) {
|
||||
return getUid("height", "Max10", false);
|
||||
}
|
||||
return getUid("height", height.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Height height) {
|
||||
if (height == EnumAllele.Height.AVERAGE) {
|
||||
return getUid("height", "Max10", false);
|
||||
}
|
||||
return getUid("height", height.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Maturation maturation) {
|
||||
return getUid("maturation", maturation.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Maturation maturation) {
|
||||
return getUid("maturation", maturation.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Territory territory) {
|
||||
return getUid("territory", territory.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Territory territory) {
|
||||
return getUid("territory", territory.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Yield yield) {
|
||||
if (yield == EnumAllele.Yield.AVERAGE) {
|
||||
return getUid("yield", "Default", false);
|
||||
}
|
||||
return getUid("yield", yield.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Yield yield) {
|
||||
if (yield == EnumAllele.Yield.AVERAGE) {
|
||||
return getUid("yield", "Default", false);
|
||||
}
|
||||
return getUid("yield", yield.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Fireproof fireproof) {
|
||||
return getUid("bool", fireproof.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Fireproof fireproof) {
|
||||
return getUid("bool", fireproof.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Flowering flowering) {
|
||||
return getUid("flowering", flowering.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Flowering flowering) {
|
||||
return getUid("flowering", flowering.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumTolerance tolerance) {
|
||||
return getUid("tolerance", tolerance.name());
|
||||
}
|
||||
public static String getUid(EnumTolerance tolerance) {
|
||||
return getUid("tolerance", tolerance.name());
|
||||
}
|
||||
|
||||
public static String getUid(EnumAllele.Speed speed) {
|
||||
return getUid("speed", speed.name());
|
||||
}
|
||||
public static String getUid(EnumAllele.Speed speed) {
|
||||
return getUid("speed", speed.name());
|
||||
}
|
||||
|
||||
protected static String getUid(String key, String valueName) {
|
||||
return getUid(key, valueName, true);
|
||||
}
|
||||
protected static String getUid(String key, String valueName) {
|
||||
return getUid(key, valueName, true);
|
||||
}
|
||||
|
||||
private static String getUid(String key, String valueName, boolean needCapitalize) {
|
||||
if (needCapitalize) {
|
||||
valueName = WordUtils.capitalize(valueName.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
valueName = valueName.replace("_", "");
|
||||
return "forestry." + key + valueName;
|
||||
}
|
||||
private static String getUid(String key, String valueName, boolean needCapitalize) {
|
||||
if (needCapitalize) {
|
||||
valueName = WordUtils.capitalize(valueName.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
valueName = valueName.replace("_", "");
|
||||
return "forestry." + key + valueName;
|
||||
}
|
||||
|
||||
private static String toAlleleDisplay(String key, String valueName) {
|
||||
String name = valueName.toLowerCase().replace("_", "");
|
||||
if (key == null) {
|
||||
return I18N.localise("forestry.allele." + name);
|
||||
}
|
||||
return I18N.localise("forestry.allele." + key + "." + name);
|
||||
}
|
||||
private static String toAlleleDisplay(String key, String valueName) {
|
||||
String name = valueName.toLowerCase().replace("_", "");
|
||||
if (key == null) {
|
||||
return I18N.localise("forestry.allele." + name);
|
||||
}
|
||||
return I18N.localise("forestry.allele." + key + "." + name);
|
||||
}
|
||||
}
|
||||
@@ -10,58 +10,59 @@ import binnie.genetics.item.ItemSerumArray;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Engineering {
|
||||
public static boolean isGeneAcceptor(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
if (stack.getItem() instanceof IItemSerum) {
|
||||
return ((IItemSerum) stack.getItem()).getCharges(stack) == 0;
|
||||
}
|
||||
return stack.getItem() == Genetics.itemGenetics
|
||||
&& (stack.getItemDamage() == GeneticsItems.EmptySerum.ordinal() || stack.getItemDamage() == GeneticsItems.EmptyGenome.ordinal());
|
||||
}
|
||||
public static boolean isGeneAcceptor(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
if (stack.getItem() instanceof IItemSerum) {
|
||||
return ((IItemSerum) stack.getItem()).getCharges(stack) == 0;
|
||||
}
|
||||
return stack.getItem() == Genetics.itemGenetics
|
||||
&& (stack.getItemDamage() == GeneticsItems.EmptySerum.ordinal()
|
||||
|| stack.getItemDamage() == GeneticsItems.EmptyGenome.ordinal());
|
||||
}
|
||||
|
||||
public static boolean canAcceptGene(ItemStack stack, IGene gene) {
|
||||
if (stack.getItem() instanceof ItemSerum) {
|
||||
return true;
|
||||
}
|
||||
if (stack.getItem() instanceof IItemSerum) {
|
||||
return ((IItemSerum) stack.getItem()).getSpeciesRoot(stack) == gene.getSpeciesRoot();
|
||||
}
|
||||
return isGeneAcceptor(stack);
|
||||
}
|
||||
public static boolean canAcceptGene(ItemStack stack, IGene gene) {
|
||||
if (stack.getItem() instanceof ItemSerum) {
|
||||
return true;
|
||||
}
|
||||
if (stack.getItem() instanceof IItemSerum) {
|
||||
return ((IItemSerum) stack.getItem()).getSpeciesRoot(stack) == gene.getSpeciesRoot();
|
||||
}
|
||||
return isGeneAcceptor(stack);
|
||||
}
|
||||
|
||||
public static IGene getGene(ItemStack stack, int chromosome) {
|
||||
if (stack.getItem() instanceof IItemSerum) {
|
||||
return ((IItemSerum) stack.getItem()).getGene(stack, chromosome);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static IGene getGene(ItemStack stack, int chromosome) {
|
||||
if (stack.getItem() instanceof IItemSerum) {
|
||||
return ((IItemSerum) stack.getItem()).getGene(stack, chromosome);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack addGene(ItemStack stack, IGene gene) {
|
||||
if (stack.getItem() instanceof IItemSerum) {
|
||||
((IItemSerum) stack.getItem()).addGene(stack, gene);
|
||||
}
|
||||
if (stack.getItem() == Genetics.itemGenetics && stack.getItemDamage() == GeneticsItems.EmptySerum.ordinal()) {
|
||||
return ItemSerum.create(gene);
|
||||
}
|
||||
if (stack.getItem() == Genetics.itemGenetics && stack.getItemDamage() == GeneticsItems.EmptyGenome.ordinal()) {
|
||||
return ItemSerumArray.create(gene);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
public static ItemStack addGene(ItemStack stack, IGene gene) {
|
||||
if (stack.getItem() instanceof IItemSerum) {
|
||||
((IItemSerum) stack.getItem()).addGene(stack, gene);
|
||||
}
|
||||
if (stack.getItem() == Genetics.itemGenetics && stack.getItemDamage() == GeneticsItems.EmptySerum.ordinal()) {
|
||||
return ItemSerum.create(gene);
|
||||
}
|
||||
if (stack.getItem() == Genetics.itemGenetics && stack.getItemDamage() == GeneticsItems.EmptyGenome.ordinal()) {
|
||||
return ItemSerumArray.create(gene);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static IGene[] getGenes(ItemStack serum) {
|
||||
if (serum.getItem() instanceof IItemSerum) {
|
||||
return ((IItemSerum) serum.getItem()).getGenes(serum);
|
||||
}
|
||||
if (serum.getItem() == Genetics.itemSequencer) {
|
||||
return new IGene[]{new SequencerItem(serum).gene};
|
||||
}
|
||||
return new IGene[0];
|
||||
}
|
||||
public static IGene[] getGenes(ItemStack serum) {
|
||||
if (serum.getItem() instanceof IItemSerum) {
|
||||
return ((IItemSerum) serum.getItem()).getGenes(serum);
|
||||
}
|
||||
if (serum.getItem() == Genetics.itemSequencer) {
|
||||
return new IGene[] {new SequencerItem(serum).gene};
|
||||
}
|
||||
return new IGene[0];
|
||||
}
|
||||
|
||||
public static int getCharges(ItemStack serum) {
|
||||
return ((IItemChargable) serum.getItem()).getCharges(serum);
|
||||
}
|
||||
public static int getCharges(ItemStack serum) {
|
||||
return ((IItemChargable) serum.getItem()).getCharges(serum);
|
||||
}
|
||||
}
|
||||
@@ -8,132 +8,132 @@ import binnie.core.util.I18N;
|
||||
import binnie.genetics.api.IGene;
|
||||
import forestry.api.core.INBTTagable;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GeneArrayItem implements INBTTagable, IGeneItem {
|
||||
protected List<IGene> genes;
|
||||
protected List<IGene> genes;
|
||||
|
||||
public GeneArrayItem(ItemStack stack) {
|
||||
genes = new ArrayList<>();
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
readFromNBT(stack.getTagCompound());
|
||||
}
|
||||
public GeneArrayItem(ItemStack stack) {
|
||||
genes = new ArrayList<>();
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
readFromNBT(stack.getTagCompound());
|
||||
}
|
||||
|
||||
public GeneArrayItem(IGene gene) {
|
||||
genes = new ArrayList<>();
|
||||
addGene(gene);
|
||||
}
|
||||
public GeneArrayItem(IGene gene) {
|
||||
genes = new ArrayList<>();
|
||||
addGene(gene);
|
||||
}
|
||||
|
||||
public GeneArrayItem() {
|
||||
genes = new ArrayList<>();
|
||||
}
|
||||
public GeneArrayItem() {
|
||||
genes = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour(int color) {
|
||||
if (color == 2) {
|
||||
return getBreedingSystem().getColor();
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
@Override
|
||||
public int getColour(int color) {
|
||||
if (color == 2) {
|
||||
return getBreedingSystem().getColor();
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getInfo(List tooltip) {
|
||||
List<Object> totalList = new ArrayList<>();
|
||||
for (IGene gene : genes) {
|
||||
String chromosomeName = getBreedingSystem().getChromosomeName(gene.getChromosome());
|
||||
totalList.add(EnumChatFormatting.GOLD + chromosomeName + EnumChatFormatting.GRAY + ": " + gene.getName());
|
||||
}
|
||||
@Override
|
||||
public void getInfo(List tooltip) {
|
||||
List<Object> totalList = new ArrayList<>();
|
||||
for (IGene gene : genes) {
|
||||
String chromosomeName = getBreedingSystem().getChromosomeName(gene.getChromosome());
|
||||
totalList.add(EnumChatFormatting.GOLD + chromosomeName + EnumChatFormatting.GRAY + ": " + gene.getName());
|
||||
}
|
||||
|
||||
if (totalList.size() < 4 || BinnieCore.proxy.isShiftDown()) {
|
||||
tooltip.addAll(totalList);
|
||||
} else {
|
||||
tooltip.add(totalList.get(0));
|
||||
tooltip.add(totalList.get(1));
|
||||
tooltip.add(I18N.localise("genetics.gene.more", totalList.size() - 2));
|
||||
}
|
||||
}
|
||||
if (totalList.size() < 4 || BinnieCore.proxy.isShiftDown()) {
|
||||
tooltip.addAll(totalList);
|
||||
} else {
|
||||
tooltip.add(totalList.get(0));
|
||||
tooltip.add(totalList.get(1));
|
||||
tooltip.add(I18N.localise("genetics.gene.more", totalList.size() - 2));
|
||||
}
|
||||
}
|
||||
|
||||
public BreedingSystem getBreedingSystem() {
|
||||
if (genes.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(genes.get(0).getSpeciesRoot().getUID());
|
||||
return (system == null) ? Binnie.Genetics.getActiveSystems().iterator().next() : system;
|
||||
}
|
||||
public BreedingSystem getBreedingSystem() {
|
||||
if (genes.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
BreedingSystem system =
|
||||
Binnie.Genetics.getSystem(genes.get(0).getSpeciesRoot().getUID());
|
||||
return (system == null) ? Binnie.Genetics.getActiveSystems().iterator().next() : system;
|
||||
}
|
||||
|
||||
public List<IGene> getGenes() {
|
||||
return genes;
|
||||
}
|
||||
public List<IGene> getGenes() {
|
||||
return genes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
genes.clear();
|
||||
if (nbt == null) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
genes.clear();
|
||||
if (nbt == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagList list = nbt.getTagList("genes", 10);
|
||||
for (int i = 0; i < list.tagCount(); ++i) {
|
||||
Gene gene = Gene.create(list.getCompoundTagAt(i));
|
||||
genes.add(gene);
|
||||
}
|
||||
}
|
||||
NBTTagList list = nbt.getTagList("genes", 10);
|
||||
for (int i = 0; i < list.tagCount(); ++i) {
|
||||
Gene gene = Gene.create(list.getCompoundTagAt(i));
|
||||
genes.add(gene);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
if (genes.size() == 0) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
if (genes.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (IGene gene : genes) {
|
||||
NBTTagCompound geneNBT = gene.getNBTTagCompound();
|
||||
list.appendTag(geneNBT);
|
||||
}
|
||||
nbt.setTag("genes", list);
|
||||
}
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (IGene gene : genes) {
|
||||
NBTTagCompound geneNBT = gene.getNBTTagCompound();
|
||||
list.appendTag(geneNBT);
|
||||
}
|
||||
nbt.setTag("genes", list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
if (genes.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return genes.get(0).getSpeciesRoot();
|
||||
}
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
if (genes.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return genes.get(0).getSpeciesRoot();
|
||||
}
|
||||
|
||||
public IGene getGene(int chromosome) {
|
||||
for (IGene gene : genes) {
|
||||
if (gene.getChromosome().ordinal() == chromosome) {
|
||||
return gene;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public IGene getGene(int chromosome) {
|
||||
for (IGene gene : genes) {
|
||||
if (gene.getChromosome().ordinal() == chromosome) {
|
||||
return gene;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToItem(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void writeToItem(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound nbt = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
stack.setTagCompound(nbt);
|
||||
}
|
||||
NBTTagCompound nbt = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
stack.setTagCompound(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGene(IGene gene) {
|
||||
if (getGene(gene.getChromosome().ordinal()) != null) {
|
||||
genes.remove(getGene(gene.getChromosome().ordinal()));
|
||||
}
|
||||
genes.add(gene);
|
||||
}
|
||||
@Override
|
||||
public void addGene(IGene gene) {
|
||||
if (getGene(gene.getChromosome().ordinal()) != null) {
|
||||
genes.remove(getGene(gene.getChromosome().ordinal()));
|
||||
}
|
||||
genes.add(gene);
|
||||
}
|
||||
}
|
||||
@@ -1,100 +1,97 @@
|
||||
package binnie.genetics.genetics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.genetics.Gene;
|
||||
import binnie.genetics.api.IGene;
|
||||
import forestry.api.core.INBTTagable;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class GeneItem implements INBTTagable, IGeneItem {
|
||||
protected IGene gene;
|
||||
protected IGene gene;
|
||||
|
||||
public GeneItem(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
readFromNBT(stack.getTagCompound());
|
||||
}
|
||||
public GeneItem(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
readFromNBT(stack.getTagCompound());
|
||||
}
|
||||
|
||||
public GeneItem(IGene gene) {
|
||||
this.gene = gene;
|
||||
}
|
||||
public GeneItem(IGene gene) {
|
||||
this.gene = gene;
|
||||
}
|
||||
|
||||
public boolean isCorrupted() {
|
||||
return gene == null;
|
||||
}
|
||||
public boolean isCorrupted() {
|
||||
return gene == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToItem(ItemStack stack) {
|
||||
if (gene == null || stack == null) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void writeToItem(ItemStack stack) {
|
||||
if (gene == null || stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound nbt = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
stack.setTagCompound(nbt);
|
||||
}
|
||||
NBTTagCompound nbt = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
stack.setTagCompound(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour(int color) {
|
||||
if (color == 2 && getBreedingSystem() != null) {
|
||||
return getBreedingSystem().getColor();
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
@Override
|
||||
public int getColour(int color) {
|
||||
if (color == 2 && getBreedingSystem() != null) {
|
||||
return getBreedingSystem().getColor();
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getInfo(List tooltip) {
|
||||
String chromosomeName = getBreedingSystem().getChromosomeName(gene.getChromosome());
|
||||
tooltip.add(EnumChatFormatting.GOLD + chromosomeName + EnumChatFormatting.GRAY + ": " + gene.getName());
|
||||
}
|
||||
@Override
|
||||
public void getInfo(List tooltip) {
|
||||
String chromosomeName = getBreedingSystem().getChromosomeName(gene.getChromosome());
|
||||
tooltip.add(EnumChatFormatting.GOLD + chromosomeName + EnumChatFormatting.GRAY + ": " + gene.getName());
|
||||
}
|
||||
|
||||
public BreedingSystem getBreedingSystem() {
|
||||
if (gene == null) {
|
||||
return null;
|
||||
}
|
||||
return Binnie.Genetics.getSystem(gene.getSpeciesRoot().getUID());
|
||||
}
|
||||
public BreedingSystem getBreedingSystem() {
|
||||
if (gene == null) {
|
||||
return null;
|
||||
}
|
||||
return Binnie.Genetics.getSystem(gene.getSpeciesRoot().getUID());
|
||||
}
|
||||
|
||||
public IGene getGene() {
|
||||
return gene;
|
||||
}
|
||||
public IGene getGene() {
|
||||
return gene;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
if (nbt != null) {
|
||||
gene = Gene.create(nbt.getCompoundTag("gene"));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
if (nbt != null) {
|
||||
gene = Gene.create(nbt.getCompoundTag("gene"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
if (gene == null) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
if (gene == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound geneNBT = gene.getNBTTagCompound();
|
||||
nbt.setTag("gene", geneNBT);
|
||||
}
|
||||
NBTTagCompound geneNBT = gene.getNBTTagCompound();
|
||||
nbt.setTag("gene", geneNBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
if (gene != null) {
|
||||
return gene.getSpeciesRoot();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
if (gene != null) {
|
||||
return gene.getSpeciesRoot();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGene(IGene gene) {
|
||||
this.gene = gene;
|
||||
}
|
||||
@Override
|
||||
public void addGene(IGene gene) {
|
||||
this.gene = gene;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@@ -17,99 +18,97 @@ import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GeneTracker extends WorldSavedData {
|
||||
GameProfile username;
|
||||
private ArrayList<IGene> discoveredGenes;
|
||||
GameProfile username;
|
||||
private ArrayList<IGene> discoveredGenes;
|
||||
|
||||
public GeneTracker(String s, GameProfile username) {
|
||||
super(s);
|
||||
discoveredGenes = new ArrayList<>();
|
||||
this.username = username;
|
||||
}
|
||||
public GeneTracker(String s, GameProfile username) {
|
||||
super(s);
|
||||
discoveredGenes = new ArrayList<>();
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public GeneTracker(String s) {
|
||||
super(s);
|
||||
discoveredGenes = new ArrayList<>();
|
||||
}
|
||||
public GeneTracker(String s) {
|
||||
super(s);
|
||||
discoveredGenes = new ArrayList<>();
|
||||
}
|
||||
|
||||
protected static GeneTracker getCommonTracker(EntityPlayer player) {
|
||||
return getTracker(player.worldObj, null);
|
||||
}
|
||||
protected static GeneTracker getCommonTracker(EntityPlayer player) {
|
||||
return getTracker(player.worldObj, null);
|
||||
}
|
||||
|
||||
public static GeneTracker getTracker(World world, GameProfile player) {
|
||||
String filename = "GeneTracker." + ((player == null) ? "common" : player.getId());
|
||||
GeneTracker tracker = (GeneTracker) world.loadItemData(GeneTracker.class, filename);
|
||||
if (tracker == null) {
|
||||
tracker = new GeneTracker(filename, player);
|
||||
world.setItemData(filename, tracker);
|
||||
} else {
|
||||
tracker.username = player;
|
||||
}
|
||||
return tracker;
|
||||
}
|
||||
public static GeneTracker getTracker(World world, GameProfile player) {
|
||||
String filename = "GeneTracker." + ((player == null) ? "common" : player.getId());
|
||||
GeneTracker tracker = (GeneTracker) world.loadItemData(GeneTracker.class, filename);
|
||||
if (tracker == null) {
|
||||
tracker = new GeneTracker(filename, player);
|
||||
world.setItemData(filename, tracker);
|
||||
} else {
|
||||
tracker.username = player;
|
||||
}
|
||||
return tracker;
|
||||
}
|
||||
|
||||
public void synchToPlayer(EntityPlayer player) {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeToNBT(nbttagcompound);
|
||||
Genetics.proxy.sendToPlayer(new MessageNBT(GeneticsPacket.GeneTrackerSync.ordinal(), nbttagcompound), player);
|
||||
}
|
||||
public void synchToPlayer(EntityPlayer player) {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeToNBT(nbttagcompound);
|
||||
Genetics.proxy.sendToPlayer(new MessageNBT(GeneticsPacket.GeneTrackerSync.ordinal(), nbttagcompound), player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
if (!nbt.hasKey(root.getUID())) {
|
||||
continue;
|
||||
}
|
||||
NBTTagCompound nbtRoot = nbt.getCompoundTag(root.getUID());
|
||||
for (IChromosomeType chromo : root.getKaryotype()) {
|
||||
if (!nbtRoot.hasKey("" + chromo.ordinal())) {
|
||||
continue;
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
if (!nbt.hasKey(root.getUID())) {
|
||||
continue;
|
||||
}
|
||||
NBTTagCompound nbtRoot = nbt.getCompoundTag(root.getUID());
|
||||
for (IChromosomeType chromo : root.getKaryotype()) {
|
||||
if (!nbtRoot.hasKey("" + chromo.ordinal())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NBTTagList nbtChromo = nbtRoot.getTagList("" + chromo.ordinal(), 8);
|
||||
for (int i = 0; i < nbtChromo.tagCount(); ++i) {
|
||||
String uid = nbtChromo.getStringTagAt(i);
|
||||
IAllele allele = AlleleManager.alleleRegistry.getAllele(uid);
|
||||
Gene gene = new Gene(allele, chromo, root);
|
||||
if (allele != null && !discoveredGenes.contains(gene)) {
|
||||
discoveredGenes.add(gene);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NBTTagList nbtChromo = nbtRoot.getTagList("" + chromo.ordinal(), 8);
|
||||
for (int i = 0; i < nbtChromo.tagCount(); ++i) {
|
||||
String uid = nbtChromo.getStringTagAt(i);
|
||||
IAllele allele = AlleleManager.alleleRegistry.getAllele(uid);
|
||||
Gene gene = new Gene(allele, chromo, root);
|
||||
if (allele != null && !discoveredGenes.contains(gene)) {
|
||||
discoveredGenes.add(gene);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
NBTTagCompound nbtRoot = new NBTTagCompound();
|
||||
for (IChromosomeType chromo : root.getKaryotype()) {
|
||||
NBTTagList nbtChromo = new NBTTagList();
|
||||
for (IGene gene : discoveredGenes) {
|
||||
if (gene.getSpeciesRoot() == root && gene.getChromosome() == chromo) {
|
||||
nbtChromo.appendTag(new NBTTagString(gene.getAllele().getUID()));
|
||||
}
|
||||
}
|
||||
nbtRoot.setTag("" + chromo.ordinal(), nbtChromo);
|
||||
}
|
||||
nbt.setTag(root.getUID(), nbtRoot);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
NBTTagCompound nbtRoot = new NBTTagCompound();
|
||||
for (IChromosomeType chromo : root.getKaryotype()) {
|
||||
NBTTagList nbtChromo = new NBTTagList();
|
||||
for (IGene gene : discoveredGenes) {
|
||||
if (gene.getSpeciesRoot() == root && gene.getChromosome() == chromo) {
|
||||
nbtChromo.appendTag(new NBTTagString(gene.getAllele().getUID()));
|
||||
}
|
||||
}
|
||||
nbtRoot.setTag("" + chromo.ordinal(), nbtChromo);
|
||||
}
|
||||
nbt.setTag(root.getUID(), nbtRoot);
|
||||
}
|
||||
}
|
||||
|
||||
public void registerGene(IGene iGene) {
|
||||
if (!discoveredGenes.contains(iGene)) {
|
||||
discoveredGenes.add(iGene);
|
||||
}
|
||||
markDirty();
|
||||
}
|
||||
public void registerGene(IGene iGene) {
|
||||
if (!discoveredGenes.contains(iGene)) {
|
||||
discoveredGenes.add(iGene);
|
||||
}
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public int getGenesSequenced() {
|
||||
return discoveredGenes.size();
|
||||
}
|
||||
public int getGenesSequenced() {
|
||||
return discoveredGenes.size();
|
||||
}
|
||||
|
||||
public boolean isSequenced(Gene gene) {
|
||||
return discoveredGenes.contains(gene);
|
||||
}
|
||||
public boolean isSequenced(Gene gene) {
|
||||
return discoveredGenes.contains(gene);
|
||||
}
|
||||
}
|
||||
@@ -2,18 +2,17 @@ package binnie.genetics.genetics;
|
||||
|
||||
import binnie.genetics.api.IGene;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IGeneItem {
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
void getInfo(List tooltip);
|
||||
void getInfo(List tooltip);
|
||||
|
||||
int getColour(int color);
|
||||
int getColour(int color);
|
||||
|
||||
void writeToItem(ItemStack stack);
|
||||
void writeToItem(ItemStack stack);
|
||||
|
||||
void addGene(IGene gene);
|
||||
void addGene(IGene gene);
|
||||
}
|
||||
@@ -5,30 +5,30 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class SequencerItem extends GeneItem {
|
||||
public int sequenced;
|
||||
public boolean analysed;
|
||||
public int sequenced;
|
||||
public boolean analysed;
|
||||
|
||||
public SequencerItem(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
public SequencerItem(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
public SequencerItem(IGene gene) {
|
||||
super(gene);
|
||||
sequenced = 0;
|
||||
analysed = false;
|
||||
}
|
||||
public SequencerItem(IGene gene) {
|
||||
super(gene);
|
||||
sequenced = 0;
|
||||
analysed = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
sequenced = nbt.getByte("seq");
|
||||
analysed = nbt.getBoolean("ana");
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
sequenced = nbt.getByte("seq");
|
||||
analysed = nbt.getBoolean("ana");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setByte("seq", (byte) sequenced);
|
||||
nbt.setBoolean("ana", analysed);
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setByte("seq", (byte) sequenced);
|
||||
nbt.setBoolean("ana", analysed);
|
||||
}
|
||||
}
|
||||
@@ -14,62 +14,70 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class AnalystPageAppearance extends ControlAnalystPage {
|
||||
public AnalystPageAppearance(IWidget parent, IArea area, IFlower ind) {
|
||||
super(parent, area);
|
||||
setColor(0x333333);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
public AnalystPageAppearance(IWidget parent, IArea area, IFlower ind) {
|
||||
super(parent, area);
|
||||
setColor(0x333333);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 12;
|
||||
|
||||
ControlColorDisplay a = new ControlColorDisplay(this, w() / 2.0f - 28.0f, y);
|
||||
a.setValue(ind.getGenome().getPrimaryColor());
|
||||
a.addTooltip(I18N.localise("genetics.gui.analyst.primaryColor"));
|
||||
ControlColorDisplay a = new ControlColorDisplay(this, w() / 2.0f - 28.0f, y);
|
||||
a.setValue(ind.getGenome().getPrimaryColor());
|
||||
a.addTooltip(I18N.localise("genetics.gui.analyst.primaryColor"));
|
||||
|
||||
ControlColorDisplay b = new ControlColorDisplay(this, w() / 2.0f - 8.0f, y);
|
||||
b.setValue(ind.getGenome().getSecondaryColor());
|
||||
b.addTooltip(I18N.localise("genetics.gui.analyst.secondaryColor"));
|
||||
ControlColorDisplay b = new ControlColorDisplay(this, w() / 2.0f - 8.0f, y);
|
||||
b.setValue(ind.getGenome().getSecondaryColor());
|
||||
b.addTooltip(I18N.localise("genetics.gui.analyst.secondaryColor"));
|
||||
|
||||
ControlColorDisplay c = new ControlColorDisplay(this, w() / 2.0f + 12.0f, y);
|
||||
c.setValue(ind.getGenome().getStemColor());
|
||||
c.addTooltip(I18N.localise("genetics.gui.analyst.stemColor"));
|
||||
y += 26;
|
||||
ControlColorDisplay c = new ControlColorDisplay(this, w() / 2.0f + 12.0f, y);
|
||||
c.setValue(ind.getGenome().getStemColor());
|
||||
c.addTooltip(I18N.localise("genetics.gui.analyst.stemColor"));
|
||||
y += 26;
|
||||
|
||||
int sections = ind.getGenome().getType().getSections();
|
||||
int w = (sections > 1) ? 50 : 100;
|
||||
int sections = ind.getGenome().getType().getSections();
|
||||
int w = (sections > 1) ? 50 : 100;
|
||||
|
||||
new ControlIconDisplay(this, (w() - w) / 2.0f, y - ((sections == 1) ? 0 : 0), null) {
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
GL11.glPushMatrix();
|
||||
float scale = w / 16.0f;
|
||||
float dy = (sections > 1) ? 16.0f : 0.0f;
|
||||
GL11.glScalef(scale, scale, 1.0f);
|
||||
CraftGUI.render.color(ind.getGenome().getStemColor().getColor(false));
|
||||
if (sections > 1) {
|
||||
CraftGUI.render.iconBlock(new IPoint(0.0f, 0.0f), ind.getGenome().getType().getStem(EnumFlowerStage.FLOWER, true, 1));
|
||||
}
|
||||
new ControlIconDisplay(this, (w() - w) / 2.0f, y - ((sections == 1) ? 0 : 0), null) {
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
GL11.glPushMatrix();
|
||||
float scale = w / 16.0f;
|
||||
float dy = (sections > 1) ? 16.0f : 0.0f;
|
||||
GL11.glScalef(scale, scale, 1.0f);
|
||||
CraftGUI.render.color(ind.getGenome().getStemColor().getColor(false));
|
||||
if (sections > 1) {
|
||||
CraftGUI.render.iconBlock(
|
||||
new IPoint(0.0f, 0.0f), ind.getGenome().getType().getStem(EnumFlowerStage.FLOWER, true, 1));
|
||||
}
|
||||
|
||||
CraftGUI.render.iconBlock(new IPoint(0.0f, dy), ind.getGenome().getType().getStem(EnumFlowerStage.FLOWER, true, 0));
|
||||
CraftGUI.render.color(ind.getGenome().getPrimaryColor().getColor(false));
|
||||
if (sections > 1) {
|
||||
CraftGUI.render.iconBlock(new IPoint(0.0f, 0.0f), ind.getGenome().getType().getPetalIcon(EnumFlowerStage.FLOWER, true, 1));
|
||||
}
|
||||
CraftGUI.render.iconBlock(
|
||||
new IPoint(0.0f, dy), ind.getGenome().getType().getStem(EnumFlowerStage.FLOWER, true, 0));
|
||||
CraftGUI.render.color(ind.getGenome().getPrimaryColor().getColor(false));
|
||||
if (sections > 1) {
|
||||
CraftGUI.render.iconBlock(
|
||||
new IPoint(0.0f, 0.0f),
|
||||
ind.getGenome().getType().getPetalIcon(EnumFlowerStage.FLOWER, true, 1));
|
||||
}
|
||||
|
||||
CraftGUI.render.iconBlock(new IPoint(0.0f, dy), ind.getGenome().getType().getPetalIcon(EnumFlowerStage.FLOWER, true, 0));
|
||||
CraftGUI.render.color(ind.getGenome().getSecondaryColor().getColor(false));
|
||||
if (sections > 1) {
|
||||
CraftGUI.render.iconBlock(new IPoint(0.0f, 0.0f), ind.getGenome().getType().getVariantIcon(EnumFlowerStage.FLOWER, true, 1));
|
||||
}
|
||||
CraftGUI.render.iconBlock(
|
||||
new IPoint(0.0f, dy), ind.getGenome().getType().getPetalIcon(EnumFlowerStage.FLOWER, true, 0));
|
||||
CraftGUI.render.color(ind.getGenome().getSecondaryColor().getColor(false));
|
||||
if (sections > 1) {
|
||||
CraftGUI.render.iconBlock(
|
||||
new IPoint(0.0f, 0.0f),
|
||||
ind.getGenome().getType().getVariantIcon(EnumFlowerStage.FLOWER, true, 1));
|
||||
}
|
||||
|
||||
CraftGUI.render.iconBlock(new IPoint(0.0f, dy), ind.getGenome().getType().getVariantIcon(EnumFlowerStage.FLOWER, true, 0));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
};
|
||||
}
|
||||
CraftGUI.render.iconBlock(
|
||||
new IPoint(0.0f, dy),
|
||||
ind.getGenome().getType().getVariantIcon(EnumFlowerStage.FLOWER, true, 0));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.appearance");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.appearance");
|
||||
}
|
||||
}
|
||||
@@ -18,77 +18,99 @@ import forestry.plugins.PluginApiculture;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class AnalystPageBehaviour extends ControlAnalystPage {
|
||||
public AnalystPageBehaviour(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x660033);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
public AnalystPageBehaviour(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x660033);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 12;
|
||||
|
||||
if (ind instanceof IBee) {
|
||||
IBee bee = (IBee) ind;
|
||||
y += 8;
|
||||
int fertility = bee.getGenome().getFlowering();
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.pollinatesNearby") + "\n" + bee.getGenome().getFlowerProvider().getDescription())
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
if (ind instanceof IBee) {
|
||||
IBee bee = (IBee) ind;
|
||||
y += 8;
|
||||
int fertility = bee.getGenome().getFlowering();
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
I18N.localise("genetics.gui.analyst.behaviour.pollinatesNearby") + "\n"
|
||||
+ bee.getGenome().getFlowerProvider().getDescription())
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.everyTime", getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100.0f / fertility)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
I18N.localise(
|
||||
"genetics.gui.analyst.behaviour.everyTime",
|
||||
getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100.0f / fertility)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
|
||||
IAlleleBeeEffect effect = bee.getGenome().getEffect();
|
||||
int[] t = bee.getGenome().getTerritory();
|
||||
if (!effect.getUID().contains("None")) {
|
||||
String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc");
|
||||
String loc = effectDesc.isEmpty()
|
||||
? I18N.localise("genetics.gui.analyst.behaviour.effect", effect.getName())
|
||||
: effectDesc;
|
||||
IAlleleBeeEffect effect = bee.getGenome().getEffect();
|
||||
int[] t = bee.getGenome().getTerritory();
|
||||
if (!effect.getUID().contains("None")) {
|
||||
String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc");
|
||||
String loc = effectDesc.isEmpty()
|
||||
? I18N.localise("genetics.gui.analyst.behaviour.effect", effect.getName())
|
||||
: effectDesc;
|
||||
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc, TextJustification.TOP_CENTER)
|
||||
.setColor(getColor());
|
||||
y += (int) (CraftGUI.render.textHeight(loc, w() - 8.0f) + 1.0f);
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc, TextJustification.TOP_CENTER)
|
||||
.setColor(getColor());
|
||||
y += (int) (CraftGUI.render.textHeight(loc, w() - 8.0f) + 1.0f);
|
||||
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.withinBlocks", (int) (t[0] / 2.0f)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
}
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.withinBlocks", (int)
|
||||
(t[0] / 2.0f)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
}
|
||||
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.territory", t[0], t[1], t[2]))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
}
|
||||
new ControlTextCentered(
|
||||
this, y, I18N.localise("genetics.gui.analyst.behaviour.territory", t[0], t[1], t[2]))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
}
|
||||
|
||||
if (ind instanceof IButterfly) {
|
||||
IButterfly bee2 = (IButterfly) ind;
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.metabolism", Binnie.Genetics.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))))
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
if (ind instanceof IButterfly) {
|
||||
IButterfly bee2 = (IButterfly) ind;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
I18N.localise(
|
||||
"genetics.gui.analyst.behaviour.metabolism",
|
||||
Binnie.Genetics.mothBreedingSystem.getAlleleName(
|
||||
EnumButterflyChromosome.METABOLISM,
|
||||
ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))))
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.pollinatesNearby") + "\n" + bee2.getGenome().getFlowerProvider().getDescription())
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
I18N.localise("genetics.gui.analyst.behaviour.pollinatesNearby") + "\n"
|
||||
+ bee2.getGenome().getFlowerProvider().getDescription())
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.everyTime", getTimeString(1500.0f)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
new ControlTextCentered(
|
||||
this, y, I18N.localise("genetics.gui.analyst.behaviour.everyTime", getTimeString(1500.0f)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
|
||||
IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect();
|
||||
if (!effect2.getUID().contains("None")) {
|
||||
String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc");
|
||||
String loc2 = effectDesc2.isEmpty()
|
||||
? I18N.localise("genetics.gui.analyst.behaviour.effect", effect2.getName())
|
||||
: effectDesc2;
|
||||
IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect();
|
||||
if (!effect2.getUID().contains("None")) {
|
||||
String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc");
|
||||
String loc2 = effectDesc2.isEmpty()
|
||||
? I18N.localise("genetics.gui.analyst.behaviour.effect", effect2.getName())
|
||||
: effectDesc2;
|
||||
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc2, TextJustification.TOP_CENTER)
|
||||
.setColor(getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc2, TextJustification.TOP_CENTER)
|
||||
.setColor(getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.behaviour");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.behaviour");
|
||||
}
|
||||
}
|
||||
@@ -15,233 +15,270 @@ import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.text.DecimalFormat;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class AnalystPageBiology extends ControlAnalystPage {
|
||||
private static final float SPAWN_KOEF = 1365.3999f;
|
||||
|
||||
public AnalystPageBiology(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x006666);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
private static final float SPAWN_KOEF = 1365.3999f;
|
||||
|
||||
if (ind instanceof IBee) {
|
||||
IBee bee = (IBee) ind;
|
||||
if (bee.getGenome().getNocturnal()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.allDay"));
|
||||
} else if (bee.getGenome().getPrimary().isNocturnal()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.night"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.day"));
|
||||
}
|
||||
public AnalystPageBiology(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x006666);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 12;
|
||||
|
||||
if (!bee.getGenome().getTolerantFlyer()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notRain"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.rain"));
|
||||
}
|
||||
if (ind instanceof IBee) {
|
||||
IBee bee = (IBee) ind;
|
||||
if (bee.getGenome().getNocturnal()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.allDay"));
|
||||
} else if (bee.getGenome().getPrimary().isNocturnal()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.night"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.day"));
|
||||
}
|
||||
|
||||
if (bee.getGenome().getCaveDwelling()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoSky.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.underground"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconSky.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notUnderground"));
|
||||
}
|
||||
y += 30;
|
||||
} else if (ind instanceof IButterfly) {
|
||||
IButterfly moth = (IButterfly) ind;
|
||||
if (moth.getGenome().getNocturnal()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.allDay"));
|
||||
} else if (moth.getGenome().getPrimary().isNocturnal()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.night"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.day"));
|
||||
}
|
||||
if (!bee.getGenome().getTolerantFlyer()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notRain"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.rain"));
|
||||
}
|
||||
|
||||
if (!moth.getGenome().getTolerantFlyer()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notRain"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.rain"));
|
||||
}
|
||||
if (bee.getGenome().getCaveDwelling()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoSky.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.underground"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconSky.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notUnderground"));
|
||||
}
|
||||
y += 30;
|
||||
} else if (ind instanceof IButterfly) {
|
||||
IButterfly moth = (IButterfly) ind;
|
||||
if (moth.getGenome().getNocturnal()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.allDay"));
|
||||
} else if (moth.getGenome().getPrimary().isNocturnal()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.night"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.day"));
|
||||
}
|
||||
|
||||
if (moth.getGenome().getFireResist()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoFire.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.nonflammable"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconFire.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.flammable"));
|
||||
}
|
||||
y += 30;
|
||||
} else if (ind instanceof ITree) {
|
||||
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS));
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.biology.sappiness", alleleName))
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
} else {
|
||||
y += 10;
|
||||
}
|
||||
if (!moth.getGenome().getTolerantFlyer()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notRain"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.rain"));
|
||||
}
|
||||
|
||||
if (ind instanceof IBee) {
|
||||
IBee bee = (IBee) ind;
|
||||
int fertility = bee.getGenome().getFertility();
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.biology.fertility.drones", fertility))
|
||||
.setColor(getColor());
|
||||
} else {
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.biology.fertility.drone"))
|
||||
.setColor(getColor());
|
||||
}
|
||||
if (moth.getGenome().getFireResist()) {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoFire.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.nonflammable"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconFire.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.biology.flammable"));
|
||||
}
|
||||
y += 30;
|
||||
} else if (ind instanceof ITree) {
|
||||
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(
|
||||
EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS));
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC
|
||||
+ I18N.localise("genetics.gui.analyst.biology.sappiness", alleleName))
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
} else {
|
||||
y += 10;
|
||||
}
|
||||
|
||||
y += 22;
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.averageLifespan"))
|
||||
.setColor(getColor());
|
||||
if (ind instanceof IBee) {
|
||||
IBee bee = (IBee) ind;
|
||||
int fertility = bee.getGenome().getFertility();
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.BOLD
|
||||
+ I18N.localise("genetics.gui.analyst.biology.fertility.drones", fertility))
|
||||
.setColor(getColor());
|
||||
} else {
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.biology.fertility.drone"))
|
||||
.setColor(getColor());
|
||||
}
|
||||
|
||||
y += 12;
|
||||
int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getMCDayString(lifespan * (bee.getGenome().getNocturnal() ? 1.0f : 2.0f)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
}
|
||||
y += 22;
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.averageLifespan"))
|
||||
.setColor(getColor());
|
||||
|
||||
if (ind instanceof IButterfly) {
|
||||
IButterfly bee2 = (IButterfly) ind;
|
||||
int fertility = bee2.getGenome().getFertility();
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.moths", fertility))
|
||||
.setColor(getColor());
|
||||
} else {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.moth"))
|
||||
.setColor(getColor());
|
||||
}
|
||||
y += 12;
|
||||
int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.BOLD
|
||||
+ getMCDayString(lifespan * (bee.getGenome().getNocturnal() ? 1.0f : 2.0f)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
}
|
||||
|
||||
y += 32;
|
||||
float caterpillarMatureTime = SPAWN_KOEF * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2));
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.caterpillarGestation"))
|
||||
.setColor(getColor());
|
||||
if (ind instanceof IButterfly) {
|
||||
IButterfly bee2 = (IButterfly) ind;
|
||||
int fertility = bee2.getGenome().getFertility();
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(
|
||||
this, y, I18N.localise("genetics.gui.analyst.biology.fertility.moths", fertility))
|
||||
.setColor(getColor());
|
||||
} else {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.moth"))
|
||||
.setColor(getColor());
|
||||
}
|
||||
|
||||
y += 12;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getMCDayString(caterpillarMatureTime))
|
||||
.setColor(getColor());
|
||||
y += 32;
|
||||
float caterpillarMatureTime = SPAWN_KOEF
|
||||
* Math.round(
|
||||
bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2));
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.caterpillarGestation"))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 22;
|
||||
int speed = (int) (20.0f * bee2.getGenome().getSpeed());
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.flightSpeed"))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getMCDayString(caterpillarMatureTime))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.biology.blocksPerSec", speed))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
}
|
||||
y += 22;
|
||||
int speed = (int) (20.0f * bee2.getGenome().getSpeed());
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.flightSpeed"))
|
||||
.setColor(getColor());
|
||||
|
||||
if (ind instanceof ITree) {
|
||||
ITree tree = (ITree) ind;
|
||||
int fertility = (int) (1.0f / tree.getGenome().getFertility());
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.leaves", fertility))
|
||||
.setColor(getColor());
|
||||
} else {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.leaf"))
|
||||
.setColor(getColor());
|
||||
}
|
||||
y += 12;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.biology.blocksPerSec", speed))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
}
|
||||
|
||||
y += 22;
|
||||
float butterflySpawn = SPAWN_KOEF / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f);
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.mothSpawn.perLeaf", getTimeString(butterflySpawn)))
|
||||
.setColor(getColor());
|
||||
if (ind instanceof ITree) {
|
||||
ITree tree = (ITree) ind;
|
||||
int fertility = (int) (1.0f / tree.getGenome().getFertility());
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(
|
||||
this, y, I18N.localise("genetics.gui.analyst.biology.fertility.leaves", fertility))
|
||||
.setColor(getColor());
|
||||
} else {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.leaf"))
|
||||
.setColor(getColor());
|
||||
}
|
||||
|
||||
y += 34;
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.planTypes"))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
float butterflySpawn = SPAWN_KOEF
|
||||
/ (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f);
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
I18N.localise(
|
||||
"genetics.gui.analyst.biology.mothSpawn.perLeaf", getTimeString(butterflySpawn)))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
for (EnumPlantType type : tree.getGenome().getPlantTypes()) {
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + type.name())
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
}
|
||||
}
|
||||
if (ind instanceof IFlower) {
|
||||
IFlower flower = (IFlower) ind;
|
||||
float butterflySpawn2 = SPAWN_KOEF / (flower.getGenome().getSappiness() * 0.2f);
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.mothSpawn", getTimeString(butterflySpawn2)))
|
||||
.setColor(getColor());
|
||||
y += 30;
|
||||
y += 34;
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.planTypes"))
|
||||
.setColor(getColor());
|
||||
|
||||
int fertility = flower.getGenome().getFertility();
|
||||
float chanceDispersal = 0.8f;
|
||||
chanceDispersal += 0.2f * fertility;
|
||||
if (chanceDispersal > 1.0f) {
|
||||
chanceDispersal = 1.0f;
|
||||
}
|
||||
y += 12;
|
||||
for (EnumPlantType type : tree.getGenome().getPlantTypes()) {
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + type.name()).setColor(getColor());
|
||||
y += 12;
|
||||
}
|
||||
}
|
||||
if (ind instanceof IFlower) {
|
||||
IFlower flower = (IFlower) ind;
|
||||
float butterflySpawn2 = SPAWN_KOEF / (flower.getGenome().getSappiness() * 0.2f);
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
I18N.localise("genetics.gui.analyst.biology.mothSpawn", getTimeString(butterflySpawn2)))
|
||||
.setColor(getColor());
|
||||
y += 30;
|
||||
|
||||
float chancePollinate = 0.6f;
|
||||
chancePollinate += 0.25f * fertility;
|
||||
if (chancePollinate > 1.0f) {
|
||||
chancePollinate = 1.0f;
|
||||
}
|
||||
int fertility = flower.getGenome().getFertility();
|
||||
float chanceDispersal = 0.8f;
|
||||
chanceDispersal += 0.2f * fertility;
|
||||
if (chanceDispersal > 1.0f) {
|
||||
chanceDispersal = 1.0f;
|
||||
}
|
||||
|
||||
float maxAge = flower.getMaxAge();
|
||||
float ageChance = flower.getGenome().getAgeChance();
|
||||
float dispersalTime = SPAWN_KOEF / chanceDispersal;
|
||||
float pollinateTime = SPAWN_KOEF / chancePollinate;
|
||||
float lifespan2 = maxAge * 20.0f * 68.27f / ageChance;
|
||||
float floweringLifespan = (maxAge - 1) * 20.0f * 68.27f / ageChance - SPAWN_KOEF;
|
||||
float chancePollinate = 0.6f;
|
||||
chancePollinate += 0.25f * fertility;
|
||||
if (chancePollinate > 1.0f) {
|
||||
chancePollinate = 1.0f;
|
||||
}
|
||||
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.averageLifespan"))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
float maxAge = flower.getMaxAge();
|
||||
float ageChance = flower.getGenome().getAgeChance();
|
||||
float dispersalTime = SPAWN_KOEF / chanceDispersal;
|
||||
float pollinateTime = SPAWN_KOEF / chancePollinate;
|
||||
float lifespan2 = maxAge * 20.0f * 68.27f / ageChance;
|
||||
float floweringLifespan = (maxAge - 1) * 20.0f * 68.27f / ageChance - SPAWN_KOEF;
|
||||
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getMCDayString(lifespan2))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.averageLifespan"))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.seedDispersal"))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getMCDayString(lifespan2)).setColor(getColor());
|
||||
y += 22;
|
||||
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.biology.perLifetime", (int) (floweringLifespan / dispersalTime)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.seedDispersal"))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.pollination"))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC
|
||||
+ I18N.localise("genetics.gui.analyst.biology.perLifetime", (int)
|
||||
(floweringLifespan / dispersalTime)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.biology.perLifetime", (int) (floweringLifespan / pollinateTime)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
}
|
||||
setSize(new IPoint(w(), y));
|
||||
}
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.pollination"))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
|
||||
private String getMCDayString(float time) {
|
||||
float seconds = time / 20.0f;
|
||||
float minutes = seconds / 60.0f;
|
||||
float days = minutes / 20.0f;
|
||||
DecimalFormat df = new DecimalFormat("#.#");
|
||||
return I18N.localise("genetics.gui.analyst.biology.mcDays", df.format(days));
|
||||
}
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC
|
||||
+ I18N.localise("genetics.gui.analyst.biology.perLifetime", (int)
|
||||
(floweringLifespan / pollinateTime)))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
}
|
||||
setSize(new IPoint(w(), y));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.biology");
|
||||
}
|
||||
private String getMCDayString(float time) {
|
||||
float seconds = time / 20.0f;
|
||||
float minutes = seconds / 60.0f;
|
||||
float days = minutes / 20.0f;
|
||||
DecimalFormat df = new DecimalFormat("#.#");
|
||||
return I18N.localise("genetics.gui.analyst.biology.mcDays", df.format(days));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.biology");
|
||||
}
|
||||
}
|
||||
@@ -19,127 +19,147 @@ import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AnalystPageClimate extends ControlAnalystPage {
|
||||
public AnalystPageClimate(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x006633);
|
||||
EnumTemperature temp = ind.getGenome().getPrimary().getTemperature();
|
||||
EnumTolerance tempTol = EnumTolerance.NONE;
|
||||
EnumHumidity humid = ind.getGenome().getPrimary().getHumidity();
|
||||
EnumTolerance humidTol = EnumTolerance.NONE;
|
||||
public AnalystPageClimate(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x006633);
|
||||
EnumTemperature temp = ind.getGenome().getPrimary().getTemperature();
|
||||
EnumTolerance tempTol = EnumTolerance.NONE;
|
||||
EnumHumidity humid = ind.getGenome().getPrimary().getHumidity();
|
||||
EnumTolerance humidTol = EnumTolerance.NONE;
|
||||
|
||||
if (ind instanceof IBee) {
|
||||
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||
}
|
||||
if (ind instanceof IBee) {
|
||||
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE))
|
||||
.getValue();
|
||||
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE))
|
||||
.getValue();
|
||||
}
|
||||
|
||||
if (ind instanceof IFlower) {
|
||||
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
humidTol = EnumTolerance.BOTH_5;
|
||||
}
|
||||
if (ind instanceof IFlower) {
|
||||
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE))
|
||||
.getValue();
|
||||
humidTol = EnumTolerance.BOTH_5;
|
||||
}
|
||||
|
||||
if (ind instanceof IButterfly) {
|
||||
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||
}
|
||||
if (ind instanceof IButterfly) {
|
||||
tempTol = ((IAlleleTolerance)
|
||||
ind.getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE))
|
||||
.getValue();
|
||||
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE))
|
||||
.getValue();
|
||||
}
|
||||
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
|
||||
y += 16;
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.climate.temperature"), TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
createTemperatureBar(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, temp, tempTol);
|
||||
y += 16;
|
||||
y += 16;
|
||||
new ControlText(
|
||||
this,
|
||||
new IArea(4.0f, y, w() - 8.0f, 14.0f),
|
||||
I18N.localise("genetics.gui.analyst.climate.temperature"),
|
||||
TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
createTemperatureBar(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, temp, tempTol);
|
||||
y += 16;
|
||||
|
||||
if (!(ind instanceof IFlower)) {
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.climate.humidity"), TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
createHumidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, humid, humidTol);
|
||||
y += 16;
|
||||
}
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.climate.biomes"), TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
if (!(ind instanceof IFlower)) {
|
||||
new ControlText(
|
||||
this,
|
||||
new IArea(4.0f, y, w() - 8.0f, 14.0f),
|
||||
I18N.localise("genetics.gui.analyst.climate.humidity"),
|
||||
TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
createHumidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, humid, humidTol);
|
||||
y += 16;
|
||||
}
|
||||
new ControlText(
|
||||
this,
|
||||
new IArea(4.0f, y, w() - 8.0f, 14.0f),
|
||||
I18N.localise("genetics.gui.analyst.climate.biomes"),
|
||||
TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
List<BiomeGenBase> biomes = new ArrayList<>();
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (biome == null || !BiomeDictionary.isBiomeRegistered(biome) || biome == BiomeGenBase.frozenOcean) {
|
||||
continue;
|
||||
}
|
||||
y += 12;
|
||||
List<BiomeGenBase> biomes = new ArrayList<>();
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (biome == null || !BiomeDictionary.isBiomeRegistered(biome) || biome == BiomeGenBase.frozenOcean) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Tolerance.canTolerate(temp, EnumTemperature.getFromBiome(biome), tempTol) ||
|
||||
!Tolerance.canTolerate(humid, EnumHumidity.getFromValue(biome.rainfall), humidTol)) {
|
||||
continue;
|
||||
}
|
||||
if (!Tolerance.canTolerate(temp, EnumTemperature.getFromBiome(biome), tempTol)
|
||||
|| !Tolerance.canTolerate(humid, EnumHumidity.getFromValue(biome.rainfall), humidTol)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean match = false;
|
||||
for (BiomeGenBase eBiome : biomes) {
|
||||
if (biome.biomeName.contains(eBiome.biomeName) && EnumHumidity.getFromValue(eBiome.rainfall) == EnumHumidity.getFromValue(biome.rainfall) && EnumTemperature.getFromBiome(eBiome) == EnumTemperature.getFromBiome(biome)) {
|
||||
match = true;
|
||||
}
|
||||
}
|
||||
boolean match = false;
|
||||
for (BiomeGenBase eBiome : biomes) {
|
||||
if (biome.biomeName.contains(eBiome.biomeName)
|
||||
&& EnumHumidity.getFromValue(eBiome.rainfall) == EnumHumidity.getFromValue(biome.rainfall)
|
||||
&& EnumTemperature.getFromBiome(eBiome) == EnumTemperature.getFromBiome(biome)) {
|
||||
match = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!match) {
|
||||
biomes.add(biome);
|
||||
}
|
||||
}
|
||||
if (!match) {
|
||||
biomes.add(biome);
|
||||
}
|
||||
}
|
||||
|
||||
int maxBiomePerLine = (int) ((w() + 2.0f - 16.0f) / 18.0f);
|
||||
float biomeListX = (w() - (Math.min(maxBiomePerLine, biomes.size()) * 18 - 2)) / 2.0f;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
for (BiomeGenBase biome2 : biomes) {
|
||||
new ControlBiome(this, biomeListX + dx, y + dy, 16.0f, 16.0f, biome2);
|
||||
dx += 18;
|
||||
if (dx >= 18 * maxBiomePerLine) {
|
||||
dx = 0;
|
||||
dy += 18;
|
||||
}
|
||||
}
|
||||
setSize(new IPoint(w(), y + dy + 18 + 8));
|
||||
}
|
||||
int maxBiomePerLine = (int) ((w() + 2.0f - 16.0f) / 18.0f);
|
||||
float biomeListX = (w() - (Math.min(maxBiomePerLine, biomes.size()) * 18 - 2)) / 2.0f;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
for (BiomeGenBase biome2 : biomes) {
|
||||
new ControlBiome(this, biomeListX + dx, y + dy, 16.0f, 16.0f, biome2);
|
||||
dx += 18;
|
||||
if (dx >= 18 * maxBiomePerLine) {
|
||||
dx = 0;
|
||||
dy += 18;
|
||||
}
|
||||
}
|
||||
setSize(new IPoint(w(), y + dy + 18 + 8));
|
||||
}
|
||||
|
||||
protected void createTemperatureBar(IWidget parent, float x, float y, float w, float h, EnumTemperature value, EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumTemperature>(parent, x, y, w, h, EnumTemperature.class) {
|
||||
@Override
|
||||
protected String getName(EnumTemperature value) {
|
||||
return value.name;
|
||||
}
|
||||
protected void createTemperatureBar(
|
||||
IWidget parent, float x, float y, float w, float h, EnumTemperature value, EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumTemperature>(parent, x, y, w, h, EnumTemperature.class) {
|
||||
@Override
|
||||
protected String getName(EnumTemperature value) {
|
||||
return value.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColor(EnumTemperature value) {
|
||||
return (new int[]{0x00fffb, 0x78bbff, 0x4fff30, 0xffff00, 0xffa200, 0xff0000})[value.ordinal() - 1];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
}
|
||||
@Override
|
||||
protected int getColor(EnumTemperature value) {
|
||||
return (new int[] {0x00fffb, 0x78bbff, 0x4fff30, 0xffff00, 0xffa200, 0xff0000})[value.ordinal() - 1];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
}
|
||||
|
||||
protected void createHumidity(IWidget parent, float x, float y, float w, float h, EnumHumidity value, EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumHumidity>(parent, x, y, w, h, EnumHumidity.class) {
|
||||
@Override
|
||||
protected String getName(EnumHumidity value) {
|
||||
return value.name;
|
||||
}
|
||||
protected void createHumidity(
|
||||
IWidget parent, float x, float y, float w, float h, EnumHumidity value, EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumHumidity>(parent, x, y, w, h, EnumHumidity.class) {
|
||||
@Override
|
||||
protected String getName(EnumHumidity value) {
|
||||
return value.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColor(EnumHumidity value) {
|
||||
return (new int[]{0xffe7a3, 0x1aff00, 0x307cff})[value.ordinal()];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
}
|
||||
@Override
|
||||
protected int getColor(EnumHumidity value) {
|
||||
return (new int[] {0xffe7a3, 0x1aff00, 0x307cff})[value.ordinal()];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.climate");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.climate");
|
||||
}
|
||||
}
|
||||
@@ -20,161 +20,185 @@ import binnie.core.util.I18N;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class AnalystPageDatabase extends ControlAnalystPage {
|
||||
ControlScrollableContent scroll;
|
||||
boolean isMaster;
|
||||
ControlScrollableContent scroll;
|
||||
boolean isMaster;
|
||||
|
||||
public AnalystPageDatabase(IWidget parent, IArea area, BreedingSystem system, boolean isMaster) {
|
||||
super(parent, area);
|
||||
scroll = null;
|
||||
this.isMaster = isMaster;
|
||||
int cOfSystem = system.getColor();
|
||||
int cr = (0xFF0000 & cOfSystem) >> 16;
|
||||
int cg = (0xFF00 & cOfSystem) >> 8;
|
||||
int cb = 0xFF & cOfSystem;
|
||||
float brightness = 0.1f * cb / 255.0f + 0.35f * cr / 255.0f + 0.55f * cg / 255.0f;
|
||||
brightness = 0.3f / brightness;
|
||||
if (brightness > 1.0f) {
|
||||
brightness = 1.0f;
|
||||
}
|
||||
int newColour = (int) (cr * brightness) * 65536 + (int) (cg * brightness) * 256 + (int) (cb * brightness);
|
||||
setColor(newColour);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 16;
|
||||
new ControlTextEdit(this, 20.0f, y, w() - 40.0f, 16.0f) {
|
||||
@Override
|
||||
public void onTextEdit(String value) {
|
||||
Collection<IAlleleSpecies> options = new ArrayList<>();
|
||||
getSpecies(system);
|
||||
for (IAlleleSpecies species : getSpecies(system)) {
|
||||
if (value != null && !value.isEmpty() && !species.getName().toLowerCase().contains(value.toLowerCase())) {
|
||||
continue;
|
||||
}
|
||||
options.add(species);
|
||||
}
|
||||
scroll.deleteAllChildren();
|
||||
scroll.setScrollableContent(getItemScrollList(system, options));
|
||||
}
|
||||
public AnalystPageDatabase(IWidget parent, IArea area, BreedingSystem system, boolean isMaster) {
|
||||
super(parent, area);
|
||||
scroll = null;
|
||||
this.isMaster = isMaster;
|
||||
int cOfSystem = system.getColor();
|
||||
int cr = (0xFF0000 & cOfSystem) >> 16;
|
||||
int cg = (0xFF00 & cOfSystem) >> 8;
|
||||
int cb = 0xFF & cOfSystem;
|
||||
float brightness = 0.1f * cb / 255.0f + 0.35f * cr / 255.0f + 0.55f * cg / 255.0f;
|
||||
brightness = 0.3f / brightness;
|
||||
if (brightness > 1.0f) {
|
||||
brightness = 1.0f;
|
||||
}
|
||||
int newColour = (int) (cr * brightness) * 65536 + (int) (cg * brightness) * 256 + (int) (cb * brightness);
|
||||
setColor(newColour);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 16;
|
||||
new ControlTextEdit(this, 20.0f, y, w() - 40.0f, 16.0f) {
|
||||
@Override
|
||||
public void onTextEdit(String value) {
|
||||
Collection<IAlleleSpecies> options = new ArrayList<>();
|
||||
getSpecies(system);
|
||||
for (IAlleleSpecies species : getSpecies(system)) {
|
||||
if (value != null
|
||||
&& !value.isEmpty()
|
||||
&& !species.getName().toLowerCase().contains(value.toLowerCase())) {
|
||||
continue;
|
||||
}
|
||||
options.add(species);
|
||||
}
|
||||
scroll.deleteAllChildren();
|
||||
scroll.setScrollableContent(getItemScrollList(system, options));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.color(0x555555);
|
||||
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
|
||||
CraftGUI.render.color(AnalystPageDatabase.this.getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
|
||||
super.renderTextField();
|
||||
}
|
||||
};
|
||||
y += 22;
|
||||
new Panel(this, 3.0f, y - 1, w() - 6.0f, h() - y - 8.0f + 2.0f, MinecraftGUI.PanelType.TabOutline).setColor(getColor());
|
||||
boolean textView = false;
|
||||
Collection<IAlleleSpecies> options = getSpecies(system);
|
||||
for (IAlleleSpecies species : options) {
|
||||
String height = system.getAlleleName(EnumTreeChromosome.HEIGHT, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT));
|
||||
String fertility = system.getAlleleName(EnumTreeChromosome.FERTILITY, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.FERTILITY));
|
||||
String yield = system.getAlleleName(EnumTreeChromosome.YIELD, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.YIELD));
|
||||
String sappiness = system.getAlleleName(EnumTreeChromosome.SAPPINESS, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS));
|
||||
String maturation = system.getAlleleName(EnumTreeChromosome.MATURATION, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.MATURATION));
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.color(0x555555);
|
||||
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
|
||||
CraftGUI.render.color(AnalystPageDatabase.this.getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
|
||||
super.renderTextField();
|
||||
}
|
||||
};
|
||||
y += 22;
|
||||
new Panel(this, 3.0f, y - 1, w() - 6.0f, h() - y - 8.0f + 2.0f, MinecraftGUI.PanelType.TabOutline)
|
||||
.setColor(getColor());
|
||||
boolean textView = false;
|
||||
Collection<IAlleleSpecies> options = getSpecies(system);
|
||||
for (IAlleleSpecies species : options) {
|
||||
String height = system.getAlleleName(
|
||||
EnumTreeChromosome.HEIGHT,
|
||||
system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT));
|
||||
String fertility = system.getAlleleName(
|
||||
EnumTreeChromosome.FERTILITY,
|
||||
system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.FERTILITY));
|
||||
String yield = system.getAlleleName(
|
||||
EnumTreeChromosome.YIELD,
|
||||
system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.YIELD));
|
||||
String sappiness = system.getAlleleName(
|
||||
EnumTreeChromosome.SAPPINESS,
|
||||
system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS));
|
||||
String maturation = system.getAlleleName(
|
||||
EnumTreeChromosome.MATURATION,
|
||||
system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.MATURATION));
|
||||
}
|
||||
|
||||
if (textView) {
|
||||
scroll = new ControlListBox<IAlleleSpecies>(this, 4.0f, y, w() - 8.0f, h() - y - 8.0f - 20.0f, 0.0f) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
super.initialise();
|
||||
setOptions(options);
|
||||
}
|
||||
if (textView) {
|
||||
scroll = new ControlListBox<IAlleleSpecies>(this, 4.0f, y, w() - 8.0f, h() - y - 8.0f - 20.0f, 0.0f) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
super.initialise();
|
||||
setOptions(options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget createOption(IAlleleSpecies v, int y) {
|
||||
return new Control(getContent(), 0.0f, y, w(), 12.0f) {
|
||||
IAlleleSpecies value = v;
|
||||
@Override
|
||||
public IWidget createOption(IAlleleSpecies v, int y) {
|
||||
return new Control(getContent(), 0.0f, y, w(), 12.0f) {
|
||||
IAlleleSpecies value = v;
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.text(getArea(), TextJustification.MIDDLE_CENTER, value.getName(), 0xffffff);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
} else {
|
||||
scroll = new ControlScrollableContent(this, 4.0f, y, w() - 8.0f, h() - y - 8.0f, 0.0f);
|
||||
scroll.setScrollableContent(getItemScrollList(system, options));
|
||||
}
|
||||
new ControlScrollBar(this, scroll.x() + scroll.w() - 6.0f, scroll.y() + 3.0f, 3.0f, scroll.h() - 6.0f, scroll) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
CraftGUI.render.gradientRect(getArea(), 0x44000000 + AnalystPageDatabase.this.getColor(), 0x44000000 + AnalystPageDatabase.this.getColor());
|
||||
CraftGUI.render.solid(getRenderArea(), AnalystPageDatabase.this.getColor());
|
||||
}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.text(getArea(), TextJustification.MIDDLE_CENTER, value.getName(), 0xffffff);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
} else {
|
||||
scroll = new ControlScrollableContent(this, 4.0f, y, w() - 8.0f, h() - y - 8.0f, 0.0f);
|
||||
scroll.setScrollableContent(getItemScrollList(system, options));
|
||||
}
|
||||
new ControlScrollBar(this, scroll.x() + scroll.w() - 6.0f, scroll.y() + 3.0f, 3.0f, scroll.h() - 6.0f, scroll) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
CraftGUI.render.gradientRect(
|
||||
getArea(),
|
||||
0x44000000 + AnalystPageDatabase.this.getColor(),
|
||||
0x44000000 + AnalystPageDatabase.this.getColor());
|
||||
CraftGUI.render.solid(getRenderArea(), AnalystPageDatabase.this.getColor());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private IWidget getItemScrollList(BreedingSystem system, Collection<IAlleleSpecies> options) {
|
||||
return new Control(scroll, 0.0f, 0.0f, scroll.w(), scroll.h()) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
int maxBiomePerLine = (int) ((w() - 4.0f + 2.0f) / 18.0f);
|
||||
float biomeListX = -6.0f + (w() - (maxBiomePerLine * 18 - 2)) / 2.0f;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
for (IAlleleSpecies species : options) {
|
||||
IIndividual ind = system.getSpeciesRoot().templateAsIndividual(system.getSpeciesRoot().getTemplate(species.getUID()));
|
||||
new ControlIndividualDisplay(this, biomeListX + dx, 2 + dy, ind) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
|
||||
window.setIndividual(ind);
|
||||
}
|
||||
});
|
||||
}
|
||||
private IWidget getItemScrollList(BreedingSystem system, Collection<IAlleleSpecies> options) {
|
||||
return new Control(scroll, 0.0f, 0.0f, scroll.w(), scroll.h()) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
int maxBiomePerLine = (int) ((w() - 4.0f + 2.0f) / 18.0f);
|
||||
float biomeListX = -6.0f + (w() - (maxBiomePerLine * 18 - 2)) / 2.0f;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
for (IAlleleSpecies species : options) {
|
||||
IIndividual ind = system.getSpeciesRoot()
|
||||
.templateAsIndividual(system.getSpeciesRoot().getTemplate(species.getUID()));
|
||||
new ControlIndividualDisplay(this, biomeListX + dx, 2 + dy, ind) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
|
||||
window.setIndividual(ind);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
|
||||
if (window.getIndividual() != null && window.getIndividual().getGenome().getPrimary() == species) {
|
||||
CraftGUI.render.color(0xeeeeee);
|
||||
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(1));
|
||||
CraftGUI.render.color(AnalystPageDatabase.this.getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().outset(1));
|
||||
} else if (calculateIsMouseOver()) {
|
||||
CraftGUI.render.color(0xeeeeee);
|
||||
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(1));
|
||||
}
|
||||
super.onRenderBackground();
|
||||
}
|
||||
};
|
||||
dx += 18;
|
||||
if (dx >= 18 * maxBiomePerLine) {
|
||||
dx = 0;
|
||||
dy += 18;
|
||||
}
|
||||
}
|
||||
setSize(new IPoint(w(), 4 + dy + 18));
|
||||
}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
|
||||
if (window.getIndividual() != null
|
||||
&& window.getIndividual().getGenome().getPrimary() == species) {
|
||||
CraftGUI.render.color(0xeeeeee);
|
||||
CraftGUI.render.texture(
|
||||
CraftGUITexture.TabSolid, getArea().outset(1));
|
||||
CraftGUI.render.color(AnalystPageDatabase.this.getColor());
|
||||
CraftGUI.render.texture(
|
||||
CraftGUITexture.TabOutline, getArea().outset(1));
|
||||
} else if (calculateIsMouseOver()) {
|
||||
CraftGUI.render.color(0xeeeeee);
|
||||
CraftGUI.render.texture(
|
||||
CraftGUITexture.TabSolid, getArea().outset(1));
|
||||
}
|
||||
super.onRenderBackground();
|
||||
}
|
||||
};
|
||||
dx += 18;
|
||||
if (dx >= 18 * maxBiomePerLine) {
|
||||
dx = 0;
|
||||
dy += 18;
|
||||
}
|
||||
}
|
||||
setSize(new IPoint(w(), 4 + dy + 18));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.registry");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.registry");
|
||||
}
|
||||
|
||||
private Collection<IAlleleSpecies> getSpecies(BreedingSystem system) {
|
||||
Collection<IAlleleSpecies> species = new ArrayList<>();
|
||||
species.addAll(isMaster ? system.getAllSpecies() : system.getDiscoveredSpecies(getWindow().getWorld(), getWindow().getPlayer().getGameProfile()));
|
||||
return species;
|
||||
}
|
||||
private Collection<IAlleleSpecies> getSpecies(BreedingSystem system) {
|
||||
Collection<IAlleleSpecies> species = new ArrayList<>();
|
||||
species.addAll(
|
||||
isMaster
|
||||
? system.getAllSpecies()
|
||||
: system.getDiscoveredSpecies(
|
||||
getWindow().getWorld(), getWindow().getPlayer().getGameProfile()));
|
||||
return species;
|
||||
}
|
||||
}
|
||||
@@ -13,73 +13,96 @@ import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class AnalystPageDescription extends ControlAnalystPage {
|
||||
public AnalystPageDescription(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x333333);
|
||||
int y = 4;
|
||||
public AnalystPageDescription(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x333333);
|
||||
int y = 4;
|
||||
|
||||
IAlleleSpecies species = ind.getGenome().getPrimary();
|
||||
String branchBinomial = (species.getBranch() != null)
|
||||
? species.getBranch().getScientific()
|
||||
: I18N.localise("genetics.gui.analyst.description.unknown");
|
||||
String desc = species.getDescription();
|
||||
StringBuilder descBody = new StringBuilder(EnumChatFormatting.ITALIC.toString());
|
||||
String descSig = "";
|
||||
if (desc == null || desc.isEmpty() || desc.matches("(\\w+\\.?)+")) {
|
||||
descBody.append("");
|
||||
} else {
|
||||
String[] descStrings = desc.split("\\|");
|
||||
descBody.append(descStrings[0]);
|
||||
for (int i = 1; i < descStrings.length - 1; ++i) {
|
||||
descBody.append(" ").append(descStrings[i]);
|
||||
}
|
||||
if (descStrings.length > 1) {
|
||||
descSig += descStrings[descStrings.length - 1];
|
||||
}
|
||||
}
|
||||
IAlleleSpecies species = ind.getGenome().getPrimary();
|
||||
String branchBinomial = (species.getBranch() != null)
|
||||
? species.getBranch().getScientific()
|
||||
: I18N.localise("genetics.gui.analyst.description.unknown");
|
||||
String desc = species.getDescription();
|
||||
StringBuilder descBody = new StringBuilder(EnumChatFormatting.ITALIC.toString());
|
||||
String descSig = "";
|
||||
if (desc == null || desc.isEmpty() || desc.matches("(\\w+\\.?)+")) {
|
||||
descBody.append("");
|
||||
} else {
|
||||
String[] descStrings = desc.split("\\|");
|
||||
descBody.append(descStrings[0]);
|
||||
for (int i = 1; i < descStrings.length - 1; ++i) {
|
||||
descBody.append(" ").append(descStrings[i]);
|
||||
}
|
||||
if (descStrings.length > 1) {
|
||||
descSig += descStrings[descStrings.length - 1];
|
||||
}
|
||||
}
|
||||
|
||||
String authority = species.getAuthority();
|
||||
if (authority.contains("Binnie")) {
|
||||
authority = EnumChatFormatting.DARK_BLUE.toString() + authority;
|
||||
}
|
||||
if (authority.contains("Sengir")) {
|
||||
authority = EnumChatFormatting.DARK_GREEN.toString() + authority;
|
||||
}
|
||||
if (authority.contains("MysteriousAges")) {
|
||||
authority = EnumChatFormatting.DARK_PURPLE.toString() + authority;
|
||||
}
|
||||
String authority = species.getAuthority();
|
||||
if (authority.contains("Binnie")) {
|
||||
authority = EnumChatFormatting.DARK_BLUE.toString() + authority;
|
||||
}
|
||||
if (authority.contains("Sengir")) {
|
||||
authority = EnumChatFormatting.DARK_GREEN.toString() + authority;
|
||||
}
|
||||
if (authority.contains("MysteriousAges")) {
|
||||
authority = EnumChatFormatting.DARK_PURPLE.toString() + authority;
|
||||
}
|
||||
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
|
||||
y += 16;
|
||||
new ControlTextCentered(this, y, species.getName() + EnumChatFormatting.RESET)
|
||||
.setColor(getColor());
|
||||
y += 16;
|
||||
new ControlTextCentered(this, y, species.getName() + EnumChatFormatting.RESET).setColor(getColor());
|
||||
|
||||
y += 10;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + branchBinomial + " " + species.getBinomial() + EnumChatFormatting.RESET)
|
||||
.setColor(getColor());
|
||||
y += 10;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC + branchBinomial + " " + species.getBinomial()
|
||||
+ EnumChatFormatting.RESET)
|
||||
.setColor(getColor());
|
||||
|
||||
y += 20;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.description.discoveredBy", authority) + EnumChatFormatting.RESET)
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.BOLD
|
||||
+ I18N.localise("genetics.gui.analyst.description.discoveredBy", authority)
|
||||
+ EnumChatFormatting.RESET)
|
||||
.setColor(getColor());
|
||||
|
||||
y += (int) (3.0f + CraftGUI.render.textHeight(EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.description.discoveredBy", authority) + EnumChatFormatting.RESET, w()));
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.description.complexity", species.getComplexity()))
|
||||
.setColor(getColor());
|
||||
y += (int) (3.0f
|
||||
+ CraftGUI.render.textHeight(
|
||||
EnumChatFormatting.BOLD
|
||||
+ I18N.localise("genetics.gui.analyst.description.discoveredBy", authority)
|
||||
+ EnumChatFormatting.RESET,
|
||||
w()));
|
||||
new ControlTextCentered(
|
||||
this, y, I18N.localise("genetics.gui.analyst.description.complexity", species.getComplexity()))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 26;
|
||||
ControlText descText = new ControlText(this, new IArea(8.0f, y, w() - 16.0f, 0.0f), descBody.toString() + EnumChatFormatting.RESET, TextJustification.TOP_CENTER);
|
||||
IWidget signatureText = new ControlText(this, new IArea(8.0f, y, w() - 16.0f, 0.0f), descSig + EnumChatFormatting.RESET, TextJustification.BOTTOM_RIGHT);
|
||||
descText.setColor(getColor());
|
||||
signatureText.setColor(getColor());
|
||||
float descHeight = CraftGUI.render.textHeight(descText.getValue(), descText.getSize().x());
|
||||
signatureText.setPosition(new IPoint(signatureText.pos().x(), descText.getPosition().y() + descHeight + 10.0f));
|
||||
setSize(new IPoint(w(), 20.0f + signatureText.y()));
|
||||
}
|
||||
y += 26;
|
||||
ControlText descText = new ControlText(
|
||||
this,
|
||||
new IArea(8.0f, y, w() - 16.0f, 0.0f),
|
||||
descBody.toString() + EnumChatFormatting.RESET,
|
||||
TextJustification.TOP_CENTER);
|
||||
IWidget signatureText = new ControlText(
|
||||
this,
|
||||
new IArea(8.0f, y, w() - 16.0f, 0.0f),
|
||||
descSig + EnumChatFormatting.RESET,
|
||||
TextJustification.BOTTOM_RIGHT);
|
||||
descText.setColor(getColor());
|
||||
signatureText.setColor(getColor());
|
||||
float descHeight = CraftGUI.render.textHeight(
|
||||
descText.getValue(), descText.getSize().x());
|
||||
signatureText.setPosition(
|
||||
new IPoint(signatureText.pos().x(), descText.getPosition().y() + descHeight + 10.0f));
|
||||
setSize(new IPoint(w(), 20.0f + signatureText.y()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.description");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.description");
|
||||
}
|
||||
}
|
||||
@@ -14,126 +14,126 @@ import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.arboriculture.FruitProviderPod;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class AnalystPageFruit extends AnalystPageProduce {
|
||||
public AnalystPageFruit(IWidget parent, IArea area, ITree ind) {
|
||||
super(parent, area);
|
||||
setColor(0xcc3300);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
public AnalystPageFruit(IWidget parent, IArea area, ITree ind) {
|
||||
super(parent, area);
|
||||
setColor(0xcc3300);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD));
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.fruit.yield", alleleName))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(
|
||||
EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD));
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.fruit.yield", alleleName))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 20;
|
||||
Collection<ItemStack> products = new UniqueItemStackSet();
|
||||
Collection<ItemStack> specialties = new UniqueItemStackSet();
|
||||
Collections.addAll(products, ind.getProduceList());
|
||||
Collections.addAll(specialties, ind.getSpecialtyList());
|
||||
y += 20;
|
||||
Collection<ItemStack> products = new UniqueItemStackSet();
|
||||
Collection<ItemStack> specialties = new UniqueItemStackSet();
|
||||
Collections.addAll(products, ind.getProduceList());
|
||||
Collections.addAll(specialties, ind.getSpecialtyList());
|
||||
|
||||
try {
|
||||
if (ind.getGenome().getFruitProvider() instanceof FruitProviderPod) {
|
||||
FruitProviderPod pod = (FruitProviderPod) ind.getGenome().getFruitProvider();
|
||||
Field f = FruitProviderPod.class.getDeclaredField("drop");
|
||||
f.setAccessible(true);
|
||||
Collections.addAll(products, (ItemStack[]) f.get(pod));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
if (ind.getGenome().getFruitProvider() instanceof FruitProviderPod) {
|
||||
FruitProviderPod pod = (FruitProviderPod) ind.getGenome().getFruitProvider();
|
||||
Field f = FruitProviderPod.class.getDeclaredField("drop");
|
||||
f.setAccessible(true);
|
||||
Collections.addAll(products, (ItemStack[]) f.get(pod));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (products.size() > 0) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.natural"))
|
||||
.setColor(getColor());
|
||||
if (products.size() > 0) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.natural")).setColor(getColor());
|
||||
|
||||
y += 10;
|
||||
int w = products.size() * 18 - 2;
|
||||
int i = 0;
|
||||
for (ItemStack stack : products) {
|
||||
ControlItemDisplay d = new ControlItemDisplay(this, (w() - w) / 2.0f + 18 * i, y);
|
||||
d.setTooltip();
|
||||
d.setItemStack(stack);
|
||||
}
|
||||
y += 26;
|
||||
}
|
||||
y += 10;
|
||||
int w = products.size() * 18 - 2;
|
||||
int i = 0;
|
||||
for (ItemStack stack : products) {
|
||||
ControlItemDisplay d = new ControlItemDisplay(this, (w() - w) / 2.0f + 18 * i, y);
|
||||
d.setTooltip();
|
||||
d.setItemStack(stack);
|
||||
}
|
||||
y += 26;
|
||||
}
|
||||
|
||||
if (specialties.size() > 0) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.speciality"))
|
||||
.setColor(getColor());
|
||||
if (specialties.size() > 0) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.speciality"))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 10;
|
||||
int w = products.size() * 18 - 2;
|
||||
int i = 0;
|
||||
for (ItemStack stack : specialties) {
|
||||
ControlItemDisplay d = new ControlItemDisplay(this, (w() - w) / 2.0f + 18 * i, y);
|
||||
d.setTooltip();
|
||||
d.setItemStack(stack);
|
||||
}
|
||||
y += 26;
|
||||
}
|
||||
y += 10;
|
||||
int w = products.size() * 18 - 2;
|
||||
int i = 0;
|
||||
for (ItemStack stack : specialties) {
|
||||
ControlItemDisplay d = new ControlItemDisplay(this, (w() - w) / 2.0f + 18 * i, y);
|
||||
d.setTooltip();
|
||||
d.setItemStack(stack);
|
||||
}
|
||||
y += 26;
|
||||
}
|
||||
|
||||
Collection<ItemStack> allProducts = new UniqueItemStackSet();
|
||||
allProducts.addAll(products);
|
||||
allProducts.addAll(specialties);
|
||||
Collection<ItemStack> allProducts = new UniqueItemStackSet();
|
||||
allProducts.addAll(products);
|
||||
allProducts.addAll(specialties);
|
||||
|
||||
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
|
||||
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
|
||||
if (refinedProducts.size() > 0) {
|
||||
y = getRefined(I18N.localise("genetics.gui.analyst.fruit.refined"), y, refinedProducts);
|
||||
y += 8;
|
||||
}
|
||||
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
|
||||
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
|
||||
if (refinedProducts.size() > 0) {
|
||||
y = getRefined(I18N.localise("genetics.gui.analyst.fruit.refined"), y, refinedProducts);
|
||||
y += 8;
|
||||
}
|
||||
|
||||
if (products.size() == 0 && specialties.size() == 0) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.none"))
|
||||
.setColor(getColor());
|
||||
y += 28;
|
||||
}
|
||||
if (products.size() == 0 && specialties.size() == 0) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.none")).setColor(getColor());
|
||||
y += 28;
|
||||
}
|
||||
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.possible"))
|
||||
.setColor(getColor());
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.possible")).setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
Collection<IAllele> fruitAlleles = Binnie.Genetics.getChromosomeMap(Binnie.Genetics.getTreeRoot()).get(EnumTreeChromosome.FRUITS);
|
||||
for (IFruitFamily fam : ind.getGenome().getPrimary().getSuitableFruit()) {
|
||||
Collection<ItemStack> stacks = new UniqueItemStackSet();
|
||||
for (IAllele a : fruitAlleles) {
|
||||
if (((IAlleleFruit) a).getProvider().getFamily() == fam) {
|
||||
Collections.addAll(stacks, ((IAlleleFruit) a).getProvider().getProducts());
|
||||
Collections.addAll(stacks, ((IAlleleFruit) a).getProvider().getSpecialty());
|
||||
try {
|
||||
if (a.getUID().contains("fruitCocoa")) {
|
||||
stacks.add(new ItemStack(Items.dye, 1, 3));
|
||||
} else {
|
||||
if (!(((IAlleleFruit) a).getProvider() instanceof FruitProviderPod)) {
|
||||
continue;
|
||||
}
|
||||
FruitProviderPod pod2 = (FruitProviderPod) ((IAlleleFruit) a).getProvider();
|
||||
Field field = FruitProviderPod.class.getDeclaredField("drop");
|
||||
field.setAccessible(true);
|
||||
Collections.addAll(stacks, (ItemStack[]) field.get(pod2));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
y = getRefined(EnumChatFormatting.ITALIC + fam.getName(), y, stacks) + 2;
|
||||
}
|
||||
setSize(new IPoint(w(), y + 8));
|
||||
}
|
||||
y += 12;
|
||||
Collection<IAllele> fruitAlleles =
|
||||
Binnie.Genetics.getChromosomeMap(Binnie.Genetics.getTreeRoot()).get(EnumTreeChromosome.FRUITS);
|
||||
for (IFruitFamily fam : ind.getGenome().getPrimary().getSuitableFruit()) {
|
||||
Collection<ItemStack> stacks = new UniqueItemStackSet();
|
||||
for (IAllele a : fruitAlleles) {
|
||||
if (((IAlleleFruit) a).getProvider().getFamily() == fam) {
|
||||
Collections.addAll(stacks, ((IAlleleFruit) a).getProvider().getProducts());
|
||||
Collections.addAll(stacks, ((IAlleleFruit) a).getProvider().getSpecialty());
|
||||
try {
|
||||
if (a.getUID().contains("fruitCocoa")) {
|
||||
stacks.add(new ItemStack(Items.dye, 1, 3));
|
||||
} else {
|
||||
if (!(((IAlleleFruit) a).getProvider() instanceof FruitProviderPod)) {
|
||||
continue;
|
||||
}
|
||||
FruitProviderPod pod2 = (FruitProviderPod) ((IAlleleFruit) a).getProvider();
|
||||
Field field = FruitProviderPod.class.getDeclaredField("drop");
|
||||
field.setAccessible(true);
|
||||
Collections.addAll(stacks, (ItemStack[]) field.get(pod2));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
y = getRefined(EnumChatFormatting.ITALIC + fam.getName(), y, stacks) + 2;
|
||||
}
|
||||
setSize(new IPoint(w(), y + 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.fruit");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.fruit");
|
||||
}
|
||||
}
|
||||
@@ -20,49 +20,59 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class AnalystPageGenome extends ControlAnalystPage {
|
||||
boolean active;
|
||||
boolean active;
|
||||
|
||||
public AnalystPageGenome(IWidget parent, IArea area, boolean active, IIndividual ind) {
|
||||
super(parent, area);
|
||||
this.active = active;
|
||||
setColor(0x006699);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 16;
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass());
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(root);
|
||||
Control scaled = new Control(this, 0.0f, y, 0.0f, 0.0f) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(10.0f, -15.0f, 0.0f);
|
||||
GL11.glScalef(0.9f, 0.95f, 1.0f);
|
||||
}
|
||||
public AnalystPageGenome(IWidget parent, IArea area, boolean active, IIndividual ind) {
|
||||
super(parent, area);
|
||||
this.active = active;
|
||||
setColor(0x006699);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 16;
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass());
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(root);
|
||||
Control scaled = new Control(this, 0.0f, y, 0.0f, 0.0f) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(10.0f, -15.0f, 0.0f);
|
||||
GL11.glScalef(0.9f, 0.95f, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
};
|
||||
|
||||
for (IChromosomeType chromo : system.getActiveKaryotype()) {
|
||||
IAllele allele = active ? ind.getGenome().getActiveAllele(chromo) : ind.getGenome().getInactiveAllele(chromo);
|
||||
String alleleName = system.getAlleleName(chromo, allele);
|
||||
float height = CraftGUI.render.textHeight(alleleName, w() / 2.0f - 2.0f);
|
||||
new ControlText(scaled, new IArea(0.0f, y + (height - 9.0f) / 2.0f, w() / 2.0f - 2.0f, 0.0f), system.getChromosomeShortName(chromo) + " :", TextJustification.TOP_RIGHT)
|
||||
.setColor(getColor());
|
||||
new ControlText(scaled, new IArea(w() / 2.0f + 2.0f, y, w() / 2.0f - 2.0f, 0.0f), alleleName, TextJustification.TOP_LEFT)
|
||||
.setColor(getColor());
|
||||
y += (int) (3.0f + height);
|
||||
}
|
||||
setSize(new IPoint(w(), y + 8));
|
||||
}
|
||||
for (IChromosomeType chromo : system.getActiveKaryotype()) {
|
||||
IAllele allele = active
|
||||
? ind.getGenome().getActiveAllele(chromo)
|
||||
: ind.getGenome().getInactiveAllele(chromo);
|
||||
String alleleName = system.getAlleleName(chromo, allele);
|
||||
float height = CraftGUI.render.textHeight(alleleName, w() / 2.0f - 2.0f);
|
||||
new ControlText(
|
||||
scaled,
|
||||
new IArea(0.0f, y + (height - 9.0f) / 2.0f, w() / 2.0f - 2.0f, 0.0f),
|
||||
system.getChromosomeShortName(chromo) + " :",
|
||||
TextJustification.TOP_RIGHT)
|
||||
.setColor(getColor());
|
||||
new ControlText(
|
||||
scaled,
|
||||
new IArea(w() / 2.0f + 2.0f, y, w() / 2.0f - 2.0f, 0.0f),
|
||||
alleleName,
|
||||
TextJustification.TOP_LEFT)
|
||||
.setColor(getColor());
|
||||
y += (int) (3.0f + height);
|
||||
}
|
||||
setSize(new IPoint(w(), y + 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
if (active) {
|
||||
return I18N.localise("genetics.gui.analyst.genome.active");
|
||||
}
|
||||
return I18N.localise("genetics.gui.analyst.genome.inactive");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
if (active) {
|
||||
return I18N.localise("genetics.gui.analyst.genome.active");
|
||||
}
|
||||
return I18N.localise("genetics.gui.analyst.genome.inactive");
|
||||
}
|
||||
}
|
||||
@@ -11,53 +11,62 @@ import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class AnalystPageGrowth extends ControlAnalystPage {
|
||||
public AnalystPageGrowth(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x333333);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
public AnalystPageGrowth(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x333333);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
if (ind instanceof ITree) {
|
||||
ITree tree = (ITree) ind;
|
||||
int mat = tree.getGenome().getMaturationTime();
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.mature"))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
if (ind instanceof ITree) {
|
||||
ITree tree = (ITree) ind;
|
||||
int mat = tree.getGenome().getMaturationTime();
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.mature")).setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getTimeString(1373.3999f * mat))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getTimeString(1373.3999f * mat))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 22;
|
||||
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT));
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.height", alleleName))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(
|
||||
EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT));
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.height", alleleName))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH));
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.girth", alleleName))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(
|
||||
EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH));
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.girth", alleleName))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 20;
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.conditions"))
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.conditions"))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + tree.getGenome().getGrowthProvider().getDescription())
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC
|
||||
+ tree.getGenome().getGrowthProvider().getDescription())
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
for (String s : tree.getGenome().getGrowthProvider().getInfo()) {
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + s)
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
y += 12;
|
||||
for (String s : tree.getGenome().getGrowthProvider().getInfo()) {
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + s).setColor(getColor());
|
||||
y += 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.growth");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.growth");
|
||||
}
|
||||
}
|
||||
@@ -13,37 +13,44 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class AnalystPageKaryogram extends ControlAnalystPage {
|
||||
public AnalystPageKaryogram(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x9933ff);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
public AnalystPageKaryogram(IWidget parent, IArea area, IIndividual ind) {
|
||||
super(parent, area);
|
||||
setColor(0x9933ff);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
|
||||
y += 24;
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass());
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(root);
|
||||
int maxBiomePerLine = (int) ((w() + 4.0f - 16.0f) / 22.0f);
|
||||
float karygramX = (w() - (Math.min(maxBiomePerLine, system.getActiveKaryotype().size()) * 18 - 4)) / 2.0f;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
int rem = system.getActiveKaryotype().size();
|
||||
for (IChromosomeType type : system.getActiveKaryotype()) {
|
||||
new ControlAnalystChromosome(this, karygramX + dx, y + dy, root, type, ind.getGenome().getActiveAllele(type), ind.getGenome().getInactiveAllele(type));
|
||||
dx += 22;
|
||||
if (dx >= 22 * maxBiomePerLine - 22) {
|
||||
rem -= maxBiomePerLine - 1;
|
||||
if (rem < maxBiomePerLine) {
|
||||
karygramX += (maxBiomePerLine - 1 - rem) * 22 / 2.0f;
|
||||
}
|
||||
dx = 0;
|
||||
dy += 28;
|
||||
}
|
||||
}
|
||||
}
|
||||
y += 24;
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass());
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(root);
|
||||
int maxBiomePerLine = (int) ((w() + 4.0f - 16.0f) / 22.0f);
|
||||
float karygramX =
|
||||
(w() - (Math.min(maxBiomePerLine, system.getActiveKaryotype().size()) * 18 - 4)) / 2.0f;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
int rem = system.getActiveKaryotype().size();
|
||||
for (IChromosomeType type : system.getActiveKaryotype()) {
|
||||
new ControlAnalystChromosome(
|
||||
this,
|
||||
karygramX + dx,
|
||||
y + dy,
|
||||
root,
|
||||
type,
|
||||
ind.getGenome().getActiveAllele(type),
|
||||
ind.getGenome().getInactiveAllele(type));
|
||||
dx += 22;
|
||||
if (dx >= 22 * maxBiomePerLine - 22) {
|
||||
rem -= maxBiomePerLine - 1;
|
||||
if (rem < maxBiomePerLine) {
|
||||
karygramX += (maxBiomePerLine - 1 - rem) * 22 / 2.0f;
|
||||
}
|
||||
dx = 0;
|
||||
dy += 28;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.karyogram");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.karyogram");
|
||||
}
|
||||
}
|
||||
@@ -23,255 +23,293 @@ import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.apiculture.genetics.BeeDefinition;
|
||||
import java.util.Collection;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class AnalystPageMutations extends ControlAnalystPage {
|
||||
public AnalystPageMutations(IWidget parent, IArea area, IIndividual ind, boolean isMaster) {
|
||||
super(parent, area);
|
||||
setColor(0x333300);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
public AnalystPageMutations(IWidget parent, IArea area, IIndividual ind, boolean isMaster) {
|
||||
super(parent, area);
|
||||
setColor(0x333300);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
|
||||
y += 18;
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
|
||||
IAlleleSpecies speciesCurrent = ind.getGenome().getPrimary();
|
||||
Collection<IMutation> resultant = system.getResultantMutations(speciesCurrent);
|
||||
Collection<IMutation> further = system.getFurtherMutations(speciesCurrent);
|
||||
if (ind instanceof IBee) {
|
||||
ItemStack hive = null;
|
||||
IAlleleSpecies primary = ind.getGenome().getPrimary();
|
||||
if (primary == ExtraBeeDefinition.WATER) {
|
||||
hive = new ItemStack(ExtraBees.hive, 1, 0);
|
||||
} else if (primary == ExtraBeeDefinition.ROCK) {
|
||||
hive = new ItemStack(ExtraBees.hive, 1, 1);
|
||||
} else if (primary == ExtraBeeDefinition.BASALT) {
|
||||
hive = new ItemStack(ExtraBees.hive, 1, 2);
|
||||
} else if (primary == BeeDefinition.FOREST.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 1);
|
||||
} else if (primary == BeeDefinition.MEADOWS.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 2);
|
||||
} else if (primary == BeeDefinition.MODEST.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 3);
|
||||
} else if (primary == BeeDefinition.TROPICAL.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 4);
|
||||
} else if (primary == BeeDefinition.ENDED.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 5);
|
||||
} else if (primary == BeeDefinition.WINTRY.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 6);
|
||||
} else if (primary == BeeDefinition.MARSHY.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 7);
|
||||
} else if (primary == BeeDefinition.STEADFAST.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Blocks.chest);
|
||||
}
|
||||
y += 18;
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
|
||||
IAlleleSpecies speciesCurrent = ind.getGenome().getPrimary();
|
||||
Collection<IMutation> resultant = system.getResultantMutations(speciesCurrent);
|
||||
Collection<IMutation> further = system.getFurtherMutations(speciesCurrent);
|
||||
if (ind instanceof IBee) {
|
||||
ItemStack hive = null;
|
||||
IAlleleSpecies primary = ind.getGenome().getPrimary();
|
||||
if (primary == ExtraBeeDefinition.WATER) {
|
||||
hive = new ItemStack(ExtraBees.hive, 1, 0);
|
||||
} else if (primary == ExtraBeeDefinition.ROCK) {
|
||||
hive = new ItemStack(ExtraBees.hive, 1, 1);
|
||||
} else if (primary == ExtraBeeDefinition.BASALT) {
|
||||
hive = new ItemStack(ExtraBees.hive, 1, 2);
|
||||
} else if (primary == BeeDefinition.FOREST.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 1);
|
||||
} else if (primary == BeeDefinition.MEADOWS.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 2);
|
||||
} else if (primary == BeeDefinition.MODEST.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 3);
|
||||
} else if (primary == BeeDefinition.TROPICAL.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 4);
|
||||
} else if (primary == BeeDefinition.ENDED.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 5);
|
||||
} else if (primary == BeeDefinition.WINTRY.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 6);
|
||||
} else if (primary == BeeDefinition.MARSHY.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 7);
|
||||
} else if (primary == BeeDefinition.STEADFAST.getGenome().getPrimary()) {
|
||||
hive = new ItemStack(Blocks.chest);
|
||||
}
|
||||
|
||||
if (ind.getGenome().getPrimary() == BeeDefinition.VALIANT.getGenome().getPrimary()) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
|
||||
.setColor(getColor());
|
||||
if (ind.getGenome().getPrimary()
|
||||
== BeeDefinition.VALIANT.getGenome().getPrimary()) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 10;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.habitat.any"))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
} else if (ind.getGenome().getPrimary() == BeeDefinition.MONASTIC.getGenome().getPrimary()) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
|
||||
.setColor(getColor());
|
||||
y += 10;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.habitat.any"))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
} else if (ind.getGenome().getPrimary()
|
||||
== BeeDefinition.MONASTIC.getGenome().getPrimary()) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 10;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.habitat.villagers"))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
} else if (hive != null) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
|
||||
.setColor(getColor());
|
||||
y += 10;
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC
|
||||
+ I18N.localise("genetics.gui.analyst.mutations.habitat.villagers"))
|
||||
.setColor(getColor());
|
||||
y += 22;
|
||||
} else if (hive != null) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 10;
|
||||
ControlItemDisplay display = new ControlItemDisplay(this, (w() - 16.0f) / 2.0f, y);
|
||||
if (ind.getGenome().getPrimary() == BeeDefinition.STEADFAST.getGenome().getPrimary()) {
|
||||
display.addTooltip(I18N.localise("genetics.gui.analyst.mutations.habitat.chest"));
|
||||
} else {
|
||||
display.setTooltip();
|
||||
}
|
||||
y += 10;
|
||||
ControlItemDisplay display = new ControlItemDisplay(this, (w() - 16.0f) / 2.0f, y);
|
||||
if (ind.getGenome().getPrimary()
|
||||
== BeeDefinition.STEADFAST.getGenome().getPrimary()) {
|
||||
display.addTooltip(I18N.localise("genetics.gui.analyst.mutations.habitat.chest"));
|
||||
} else {
|
||||
display.setTooltip();
|
||||
}
|
||||
|
||||
display.setItemStack(hive);
|
||||
y += 24;
|
||||
}
|
||||
}
|
||||
display.setItemStack(hive);
|
||||
y += 24;
|
||||
}
|
||||
}
|
||||
|
||||
float ox = (w() - 88.0f - 8.0f) / 2.0f;
|
||||
float dx = 0.0f;
|
||||
float ox = (w() - 88.0f - 8.0f) / 2.0f;
|
||||
float dx = 0.0f;
|
||||
|
||||
if (!resultant.isEmpty()) {
|
||||
if (resultant.size() == 1) {
|
||||
ox = (w() - 44.0f) / 2.0f;
|
||||
}
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.resultantMutations"))
|
||||
.setColor(getColor());
|
||||
if (!resultant.isEmpty()) {
|
||||
if (resultant.size() == 1) {
|
||||
ox = (w() - 44.0f) / 2.0f;
|
||||
}
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.resultantMutations"))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 10;
|
||||
for (IMutation mutation : resultant) {
|
||||
float specificChance = getSpecificChance(mutation, system);
|
||||
if (!isMaster && !isKnown(system, mutation)) {
|
||||
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
|
||||
} else {
|
||||
new Control(this, ox + dx, y, 44.0f, 16.0f) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
IAlleleSpecies species0 = mutation.getAllele0();
|
||||
IAlleleSpecies species2 = mutation.getAllele1();
|
||||
String comb = species0.getName() + " + " + species2.getName();
|
||||
addTooltip(comb);
|
||||
String chance = getMutationColor(mutation.getBaseChance()).getCode() + I18N.localise("genetics.gui.analyst.mutations.chance", (int) mutation.getBaseChance());
|
||||
if (specificChance != mutation.getBaseChance()) {
|
||||
chance += getMutationColor(specificChance).getCode() + " " + I18N.localise("genetics.gui.analyst.mutations.chance", (int) specificChance);
|
||||
}
|
||||
y += 10;
|
||||
for (IMutation mutation : resultant) {
|
||||
float specificChance = getSpecificChance(mutation, system);
|
||||
if (!isMaster && !isKnown(system, mutation)) {
|
||||
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
|
||||
} else {
|
||||
new Control(this, ox + dx, y, 44.0f, 16.0f) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
IAlleleSpecies species0 = mutation.getAllele0();
|
||||
IAlleleSpecies species2 = mutation.getAllele1();
|
||||
String comb = species0.getName() + " + " + species2.getName();
|
||||
addTooltip(comb);
|
||||
String chance =
|
||||
getMutationColor(mutation.getBaseChance()).getCode()
|
||||
+ I18N.localise("genetics.gui.analyst.mutations.chance", (int)
|
||||
mutation.getBaseChance());
|
||||
if (specificChance != mutation.getBaseChance()) {
|
||||
chance += getMutationColor(specificChance).getCode() + " "
|
||||
+ I18N.localise("genetics.gui.analyst.mutations.chance", (int) specificChance);
|
||||
}
|
||||
|
||||
addTooltip(chance);
|
||||
for (String s : mutation.getSpecialConditions()) {
|
||||
addTooltip(s);
|
||||
}
|
||||
}
|
||||
addTooltip(chance);
|
||||
for (String s : mutation.getSpecialConditions()) {
|
||||
addTooltip(s);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.item(new IPoint(0.0f, 0.0f), system.getDefaultMember(mutation.getAllele0().getUID()));
|
||||
CraftGUI.render.item(new IPoint(28.0f, 0.0f), system.getDefaultMember(mutation.getAllele1().getUID()));
|
||||
if (specificChance != mutation.getBaseChance()) {
|
||||
CraftGUI.render.color(getMutationColor(mutation.getBaseChance()).getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd0.getIcon());
|
||||
CraftGUI.render.color(getMutationColor(specificChance).getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd1.getIcon());
|
||||
} else {
|
||||
CraftGUI.render.color(getMutationColor(mutation.getBaseChance()).getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd.getIcon());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
dx = 52.0f - dx;
|
||||
if (dx == 0.0f || resultant.size() == 1) {
|
||||
y += 18;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.item(
|
||||
new IPoint(0.0f, 0.0f),
|
||||
system.getDefaultMember(
|
||||
mutation.getAllele0().getUID()));
|
||||
CraftGUI.render.item(
|
||||
new IPoint(28.0f, 0.0f),
|
||||
system.getDefaultMember(
|
||||
mutation.getAllele1().getUID()));
|
||||
if (specificChance != mutation.getBaseChance()) {
|
||||
CraftGUI.render.color(getMutationColor(mutation.getBaseChance())
|
||||
.getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd0.getIcon());
|
||||
CraftGUI.render.color(
|
||||
getMutationColor(specificChance).getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd1.getIcon());
|
||||
} else {
|
||||
CraftGUI.render.color(getMutationColor(mutation.getBaseChance())
|
||||
.getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd.getIcon());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
dx = 52.0f - dx;
|
||||
if (dx == 0.0f || resultant.size() == 1) {
|
||||
y += 18;
|
||||
}
|
||||
}
|
||||
|
||||
if (dx != 0.0f && resultant.size() != 1) {
|
||||
y += 18;
|
||||
}
|
||||
y += 10;
|
||||
}
|
||||
if (dx != 0.0f && resultant.size() != 1) {
|
||||
y += 18;
|
||||
}
|
||||
y += 10;
|
||||
}
|
||||
|
||||
ox = (w() - 88.0f - 8.0f) / 2.0f;
|
||||
dx = 0.0f;
|
||||
if (!further.isEmpty()) {
|
||||
if (further.size() == 1) {
|
||||
ox = (w() - 44.0f) / 2.0f;
|
||||
}
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.furtherMutations"))
|
||||
.setColor(getColor());
|
||||
ox = (w() - 88.0f - 8.0f) / 2.0f;
|
||||
dx = 0.0f;
|
||||
if (!further.isEmpty()) {
|
||||
if (further.size() == 1) {
|
||||
ox = (w() - 44.0f) / 2.0f;
|
||||
}
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.furtherMutations"))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 10;
|
||||
for (IMutation mutation : further) {
|
||||
IAllele speciesComb = mutation.getPartner(speciesCurrent);
|
||||
float specificChance2 = getSpecificChance(mutation, system);
|
||||
if (!isMaster && !isKnown(system, mutation)) {
|
||||
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
|
||||
} else {
|
||||
new Control(this, ox + dx, y, 44.0f, 16.0f) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
IAlleleSpecies species0 = (IAlleleSpecies) speciesComb;
|
||||
IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0];
|
||||
addTooltip(species2.getName());
|
||||
String comb = speciesCurrent.getName() + " + " + species0.getName();
|
||||
addTooltip(comb);
|
||||
String chance = getMutationColor(mutation.getBaseChance()).getCode() + I18N.localise("genetics.gui.analyst.mutations.chance", (int) mutation.getBaseChance());
|
||||
if (specificChance2 != mutation.getBaseChance()) {
|
||||
chance = chance + getMutationColor(specificChance2).getCode() + " " + I18N.localise("genetics.gui.analyst.mutations.chance", (int) specificChance2);
|
||||
}
|
||||
addTooltip(chance);
|
||||
for (String s : mutation.getSpecialConditions()) {
|
||||
addTooltip(s);
|
||||
}
|
||||
}
|
||||
y += 10;
|
||||
for (IMutation mutation : further) {
|
||||
IAllele speciesComb = mutation.getPartner(speciesCurrent);
|
||||
float specificChance2 = getSpecificChance(mutation, system);
|
||||
if (!isMaster && !isKnown(system, mutation)) {
|
||||
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
|
||||
} else {
|
||||
new Control(this, ox + dx, y, 44.0f, 16.0f) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
IAlleleSpecies species0 = (IAlleleSpecies) speciesComb;
|
||||
IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0];
|
||||
addTooltip(species2.getName());
|
||||
String comb = speciesCurrent.getName() + " + " + species0.getName();
|
||||
addTooltip(comb);
|
||||
String chance =
|
||||
getMutationColor(mutation.getBaseChance()).getCode()
|
||||
+ I18N.localise("genetics.gui.analyst.mutations.chance", (int)
|
||||
mutation.getBaseChance());
|
||||
if (specificChance2 != mutation.getBaseChance()) {
|
||||
chance = chance
|
||||
+ getMutationColor(specificChance2).getCode() + " "
|
||||
+ I18N.localise("genetics.gui.analyst.mutations.chance", (int) specificChance2);
|
||||
}
|
||||
addTooltip(chance);
|
||||
for (String s : mutation.getSpecialConditions()) {
|
||||
addTooltip(s);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.item(new IPoint(0.0f, 0.0f), system.getDefaultMember(speciesComb.getUID()));
|
||||
CraftGUI.render.item(new IPoint(28.0f, 0.0f), system.getDefaultMember(mutation.getTemplate()[0].getUID()));
|
||||
CraftGUI.render.color(getMutationColor(mutation.getBaseChance()).getColor());
|
||||
if (specificChance2 != mutation.getBaseChance()) {
|
||||
CraftGUI.render.color(getMutationColor(mutation.getBaseChance()).getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow0.getIcon());
|
||||
CraftGUI.render.color(getMutationColor(specificChance2).getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow1.getIcon());
|
||||
} else {
|
||||
CraftGUI.render.color(getMutationColor(mutation.getBaseChance()).getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow.getIcon());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.item(new IPoint(0.0f, 0.0f), system.getDefaultMember(speciesComb.getUID()));
|
||||
CraftGUI.render.item(
|
||||
new IPoint(28.0f, 0.0f),
|
||||
system.getDefaultMember(mutation.getTemplate()[0].getUID()));
|
||||
CraftGUI.render.color(
|
||||
getMutationColor(mutation.getBaseChance()).getColor());
|
||||
if (specificChance2 != mutation.getBaseChance()) {
|
||||
CraftGUI.render.color(getMutationColor(mutation.getBaseChance())
|
||||
.getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow0.getIcon());
|
||||
CraftGUI.render.color(
|
||||
getMutationColor(specificChance2).getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow1.getIcon());
|
||||
} else {
|
||||
CraftGUI.render.color(getMutationColor(mutation.getBaseChance())
|
||||
.getColor());
|
||||
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow.getIcon());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
dx = 52.0f - dx;
|
||||
if (dx == 0.0f || further.size() == 1) {
|
||||
y += 18;
|
||||
}
|
||||
}
|
||||
dx = 52.0f - dx;
|
||||
if (dx == 0.0f || further.size() == 1) {
|
||||
y += 18;
|
||||
}
|
||||
}
|
||||
|
||||
if (dx != 0.0f && further.size() != 1) {
|
||||
y += 18;
|
||||
}
|
||||
}
|
||||
y += 8;
|
||||
setSize(new IPoint(w(), y));
|
||||
}
|
||||
if (dx != 0.0f && further.size() != 1) {
|
||||
y += 18;
|
||||
}
|
||||
}
|
||||
y += 8;
|
||||
setSize(new IPoint(w(), y));
|
||||
}
|
||||
|
||||
private boolean isKnown(BreedingSystem system, IMutation mutation) {
|
||||
return system.getDiscoveredMutations(getWindow().getWorld(), getWindow().getPlayer().getGameProfile()).contains(mutation);
|
||||
}
|
||||
private boolean isKnown(BreedingSystem system, IMutation mutation) {
|
||||
return system.getDiscoveredMutations(
|
||||
getWindow().getWorld(), getWindow().getPlayer().getGameProfile())
|
||||
.contains(mutation);
|
||||
}
|
||||
|
||||
private float getSpecificChance(IMutation mutation, BreedingSystem system) {
|
||||
return system.getChance(mutation, getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1());
|
||||
}
|
||||
private float getSpecificChance(IMutation mutation, BreedingSystem system) {
|
||||
return system.getChance(mutation, getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.mutations");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.mutations");
|
||||
}
|
||||
|
||||
protected EnumColor getMutationColor(float percent) {
|
||||
if (percent >= 20.0f) {
|
||||
return EnumColor.DarkGreen;
|
||||
}
|
||||
if (percent >= 15.0f) {
|
||||
return EnumColor.Green;
|
||||
}
|
||||
if (percent >= 10.0f) {
|
||||
return EnumColor.Yellow;
|
||||
}
|
||||
if (percent >= 5.0f) {
|
||||
return EnumColor.Gold;
|
||||
}
|
||||
if (percent > 0.0f) {
|
||||
return EnumColor.Red;
|
||||
}
|
||||
return EnumColor.DarkRed;
|
||||
}
|
||||
protected EnumColor getMutationColor(float percent) {
|
||||
if (percent >= 20.0f) {
|
||||
return EnumColor.DarkGreen;
|
||||
}
|
||||
if (percent >= 15.0f) {
|
||||
return EnumColor.Green;
|
||||
}
|
||||
if (percent >= 10.0f) {
|
||||
return EnumColor.Yellow;
|
||||
}
|
||||
if (percent >= 5.0f) {
|
||||
return EnumColor.Gold;
|
||||
}
|
||||
if (percent > 0.0f) {
|
||||
return EnumColor.Red;
|
||||
}
|
||||
return EnumColor.DarkRed;
|
||||
}
|
||||
|
||||
static class ControlUnknownMutation extends Control {
|
||||
public ControlUnknownMutation(IWidget parent, float x, float y, float w, float h) {
|
||||
super(parent, x, y, w, h);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
addTooltip(I18N.localise("genetics.gui.analyst.mutations.unknownMutation"));
|
||||
}
|
||||
static class ControlUnknownMutation extends Control {
|
||||
public ControlUnknownMutation(IWidget parent, float x, float y, float w, float h) {
|
||||
super(parent, x, y, w, h);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
addTooltip(I18N.localise("genetics.gui.analyst.mutations.unknownMutation"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.text(getArea(), TextJustification.MIDDLE_CENTER, I18N.localise("genetics.gui.analyst.mutations.unknown"), 0xaaaaaa);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.text(
|
||||
getArea(),
|
||||
TextJustification.MIDDLE_CENTER,
|
||||
I18N.localise("genetics.gui.analyst.mutations.unknown"),
|
||||
0xaaaaaa);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,10 @@ import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||
import binnie.core.util.UniqueFluidStackSet;
|
||||
import binnie.core.util.UniqueItemStackSet;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
@@ -17,232 +21,233 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class AnalystPageProduce extends ControlAnalystPage {
|
||||
public AnalystPageProduce(IWidget parent, IArea area) {
|
||||
super(parent, area);
|
||||
}
|
||||
public AnalystPageProduce(IWidget parent, IArea area) {
|
||||
super(parent, area);
|
||||
}
|
||||
|
||||
protected Collection<? extends ItemStack> getAllProducts(ItemStack key) {
|
||||
Collection<ItemStack> products = new UniqueItemStackSet();
|
||||
products.addAll(getCentrifuge(key));
|
||||
products.addAll(getSqueezer(key));
|
||||
products.add(FurnaceRecipes.smelting().getSmeltingResult(key));
|
||||
products.addAll(getCrafting(key));
|
||||
return products;
|
||||
}
|
||||
protected Collection<? extends ItemStack> getAllProducts(ItemStack key) {
|
||||
Collection<ItemStack> products = new UniqueItemStackSet();
|
||||
products.addAll(getCentrifuge(key));
|
||||
products.addAll(getSqueezer(key));
|
||||
products.add(FurnaceRecipes.smelting().getSmeltingResult(key));
|
||||
products.addAll(getCrafting(key));
|
||||
return products;
|
||||
}
|
||||
|
||||
public Collection<ItemStack> getCentrifuge(ItemStack stack) {
|
||||
List<ItemStack> products = new ArrayList<>();
|
||||
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.centrifugeManager.getRecipes().entrySet()) {
|
||||
boolean isRecipe = false;
|
||||
for (Object obj : recipe.getKey()) {
|
||||
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
|
||||
isRecipe = true;
|
||||
}
|
||||
}
|
||||
public Collection<ItemStack> getCentrifuge(ItemStack stack) {
|
||||
List<ItemStack> products = new ArrayList<>();
|
||||
for (Map.Entry<Object[], Object[]> recipe :
|
||||
RecipeManagers.centrifugeManager.getRecipes().entrySet()) {
|
||||
boolean isRecipe = false;
|
||||
for (Object obj : recipe.getKey()) {
|
||||
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
|
||||
isRecipe = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isRecipe) {
|
||||
for (Object obj : recipe.getValue()) {
|
||||
if (obj instanceof ItemStack) {
|
||||
products.add((ItemStack) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return products;
|
||||
}
|
||||
if (isRecipe) {
|
||||
for (Object obj : recipe.getValue()) {
|
||||
if (obj instanceof ItemStack) {
|
||||
products.add((ItemStack) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return products;
|
||||
}
|
||||
|
||||
public Collection<ItemStack> getSqueezer(ItemStack stack) {
|
||||
List<ItemStack> products = new ArrayList<>();
|
||||
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.squeezerManager.getRecipes().entrySet()) {
|
||||
boolean isRecipe = false;
|
||||
for (Object obj : recipe.getKey()) {
|
||||
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
|
||||
isRecipe = true;
|
||||
}
|
||||
}
|
||||
public Collection<ItemStack> getSqueezer(ItemStack stack) {
|
||||
List<ItemStack> products = new ArrayList<>();
|
||||
for (Map.Entry<Object[], Object[]> recipe :
|
||||
RecipeManagers.squeezerManager.getRecipes().entrySet()) {
|
||||
boolean isRecipe = false;
|
||||
for (Object obj : recipe.getKey()) {
|
||||
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
|
||||
isRecipe = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isRecipe) {
|
||||
for (Object obj : recipe.getValue()) {
|
||||
if (obj instanceof ItemStack) {
|
||||
products.add((ItemStack) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return products;
|
||||
}
|
||||
if (isRecipe) {
|
||||
for (Object obj : recipe.getValue()) {
|
||||
if (obj instanceof ItemStack) {
|
||||
products.add((ItemStack) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return products;
|
||||
}
|
||||
|
||||
public Collection<ItemStack> getCrafting(ItemStack stack) {
|
||||
List<ItemStack> products = new ArrayList<>();
|
||||
for (Object recipeO : CraftingManager.getInstance().getRecipeList()) {
|
||||
if (recipeO instanceof ShapelessRecipes) {
|
||||
ShapelessRecipes recipe = (ShapelessRecipes) recipeO;
|
||||
boolean match = true;
|
||||
for (Object rec : recipe.recipeItems) {
|
||||
if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
public Collection<ItemStack> getCrafting(ItemStack stack) {
|
||||
List<ItemStack> products = new ArrayList<>();
|
||||
for (Object recipeO : CraftingManager.getInstance().getRecipeList()) {
|
||||
if (recipeO instanceof ShapelessRecipes) {
|
||||
ShapelessRecipes recipe = (ShapelessRecipes) recipeO;
|
||||
boolean match = true;
|
||||
for (Object rec : recipe.recipeItems) {
|
||||
if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (match) {
|
||||
products.add(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
if (match) {
|
||||
products.add(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
if (recipeO instanceof ShapedRecipes) {
|
||||
ShapedRecipes recipe2 = (ShapedRecipes) recipeO;
|
||||
boolean match = true;
|
||||
for (Object rec2 : recipe2.recipeItems) {
|
||||
if (rec2 != null && (!(rec2 instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec2))) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
if (recipeO instanceof ShapedRecipes) {
|
||||
ShapedRecipes recipe2 = (ShapedRecipes) recipeO;
|
||||
boolean match = true;
|
||||
for (Object rec2 : recipe2.recipeItems) {
|
||||
if (rec2 != null && (!(rec2 instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec2))) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (match) {
|
||||
products.add(recipe2.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
if (match) {
|
||||
products.add(recipe2.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
if (recipeO instanceof ShapelessOreRecipe) {
|
||||
ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO;
|
||||
boolean match = true;
|
||||
for (Object rec : recipe3.getInput()) {
|
||||
if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
if (recipeO instanceof ShapelessOreRecipe) {
|
||||
ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO;
|
||||
boolean match = true;
|
||||
for (Object rec : recipe3.getInput()) {
|
||||
if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!match) {
|
||||
continue;
|
||||
}
|
||||
products.add(recipe3.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
return products;
|
||||
}
|
||||
if (!match) {
|
||||
continue;
|
||||
}
|
||||
products.add(recipe3.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
return products;
|
||||
}
|
||||
|
||||
public Collection<FluidStack> getAllFluids(ItemStack stack) {
|
||||
List<FluidStack> products = new ArrayList<>();
|
||||
products.addAll(getSqueezerFluid(stack));
|
||||
return products;
|
||||
}
|
||||
public Collection<FluidStack> getAllFluids(ItemStack stack) {
|
||||
List<FluidStack> products = new ArrayList<>();
|
||||
products.addAll(getSqueezerFluid(stack));
|
||||
return products;
|
||||
}
|
||||
|
||||
public Collection<FluidStack> getSqueezerFluid(ItemStack stack) {
|
||||
List<FluidStack> products = new ArrayList<>();
|
||||
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.squeezerManager.getRecipes().entrySet()) {
|
||||
boolean isRecipe = false;
|
||||
for (Object obj : recipe.getKey()) {
|
||||
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
|
||||
isRecipe = true;
|
||||
}
|
||||
}
|
||||
public Collection<FluidStack> getSqueezerFluid(ItemStack stack) {
|
||||
List<FluidStack> products = new ArrayList<>();
|
||||
for (Map.Entry<Object[], Object[]> recipe :
|
||||
RecipeManagers.squeezerManager.getRecipes().entrySet()) {
|
||||
boolean isRecipe = false;
|
||||
for (Object obj : recipe.getKey()) {
|
||||
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
|
||||
isRecipe = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isRecipe) {
|
||||
for (Object obj : recipe.getValue()) {
|
||||
if (obj instanceof FluidStack) {
|
||||
products.add((FluidStack) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return products;
|
||||
}
|
||||
if (isRecipe) {
|
||||
for (Object obj : recipe.getValue()) {
|
||||
if (obj instanceof FluidStack) {
|
||||
products.add((FluidStack) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return products;
|
||||
}
|
||||
|
||||
protected Collection<? extends FluidStack> getAllProducts(FluidStack stack) {
|
||||
return new UniqueFluidStackSet();
|
||||
}
|
||||
protected Collection<? extends FluidStack> getAllProducts(FluidStack stack) {
|
||||
return new UniqueFluidStackSet();
|
||||
}
|
||||
|
||||
protected Collection<ItemStack> getAllProductsAndFluids(Collection<ItemStack> collection) {
|
||||
Collection<ItemStack> products = new UniqueItemStackSet();
|
||||
for (ItemStack stack : collection) {
|
||||
products.addAll(getAllProducts(stack));
|
||||
}
|
||||
protected Collection<ItemStack> getAllProductsAndFluids(Collection<ItemStack> collection) {
|
||||
Collection<ItemStack> products = new UniqueItemStackSet();
|
||||
for (ItemStack stack : collection) {
|
||||
products.addAll(getAllProducts(stack));
|
||||
}
|
||||
|
||||
Collection<ItemStack> products2 = new UniqueItemStackSet();
|
||||
for (ItemStack stack2 : products) {
|
||||
products2.addAll(getAllProducts(stack2));
|
||||
}
|
||||
Collection<ItemStack> products2 = new UniqueItemStackSet();
|
||||
for (ItemStack stack2 : products) {
|
||||
products2.addAll(getAllProducts(stack2));
|
||||
}
|
||||
|
||||
Collection<ItemStack> products3 = new UniqueItemStackSet();
|
||||
for (ItemStack stack3 : products2) {
|
||||
products3.addAll(getAllProducts(stack3));
|
||||
}
|
||||
Collection<ItemStack> products3 = new UniqueItemStackSet();
|
||||
for (ItemStack stack3 : products2) {
|
||||
products3.addAll(getAllProducts(stack3));
|
||||
}
|
||||
|
||||
products.addAll(products2);
|
||||
products.addAll(products3);
|
||||
Collection<FluidStack> allFluids = new UniqueFluidStackSet();
|
||||
for (ItemStack stack4 : collection) {
|
||||
allFluids.addAll(getAllFluids(stack4));
|
||||
}
|
||||
products.addAll(products2);
|
||||
products.addAll(products3);
|
||||
Collection<FluidStack> allFluids = new UniqueFluidStackSet();
|
||||
for (ItemStack stack4 : collection) {
|
||||
allFluids.addAll(getAllFluids(stack4));
|
||||
}
|
||||
|
||||
Collection<FluidStack> fluids2 = new UniqueFluidStackSet();
|
||||
for (FluidStack stack5 : allFluids) {
|
||||
fluids2.addAll(getAllProducts(stack5));
|
||||
}
|
||||
Collection<FluidStack> fluids2 = new UniqueFluidStackSet();
|
||||
for (FluidStack stack5 : allFluids) {
|
||||
fluids2.addAll(getAllProducts(stack5));
|
||||
}
|
||||
|
||||
Collection<FluidStack> fluids3 = new UniqueFluidStackSet();
|
||||
for (FluidStack stack6 : fluids2) {
|
||||
fluids3.addAll(getAllProducts(stack6));
|
||||
}
|
||||
Collection<FluidStack> fluids3 = new UniqueFluidStackSet();
|
||||
for (FluidStack stack6 : fluids2) {
|
||||
fluids3.addAll(getAllProducts(stack6));
|
||||
}
|
||||
|
||||
allFluids.addAll(fluids2);
|
||||
allFluids.addAll(fluids3);
|
||||
for (FluidStack fluid : allFluids) {
|
||||
ItemStack container = null;
|
||||
for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
if (data.emptyContainer.isItemEqual(new ItemStack(Items.glass_bottle)) && data.fluid.isFluidEqual(fluid)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
allFluids.addAll(fluids2);
|
||||
allFluids.addAll(fluids3);
|
||||
for (FluidStack fluid : allFluids) {
|
||||
ItemStack container = null;
|
||||
for (FluidContainerRegistry.FluidContainerData data :
|
||||
FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
if (data.emptyContainer.isItemEqual(new ItemStack(Items.glass_bottle))
|
||||
&& data.fluid.isFluidEqual(fluid)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
|
||||
if (data.emptyContainer.isItemEqual(new ItemStack(Items.bucket)) && data.fluid.isFluidEqual(fluid)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
if (data.emptyContainer.isItemEqual(new ItemStack(Items.bucket)) && data.fluid.isFluidEqual(fluid)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
|
||||
if (data.fluid.isFluidEqual(fluid)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (container != null) {
|
||||
products.add(container);
|
||||
}
|
||||
}
|
||||
return products;
|
||||
}
|
||||
if (data.fluid.isFluidEqual(fluid)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (container != null) {
|
||||
products.add(container);
|
||||
}
|
||||
}
|
||||
return products;
|
||||
}
|
||||
|
||||
protected int getRefined(String string, int y, Collection<ItemStack> products) {
|
||||
new ControlTextCentered(this, y, string).setColor(getColor());
|
||||
y += 10;
|
||||
int maxBiomePerLine = (int) ((w() + 2.0f - 16.0f) / 18.0f);
|
||||
float biomeListX = (w() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2.0f;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
for (ItemStack soilStack : products) {
|
||||
if (dx >= 18 * maxBiomePerLine) {
|
||||
dx = 0;
|
||||
dy += 18;
|
||||
}
|
||||
protected int getRefined(String string, int y, Collection<ItemStack> products) {
|
||||
new ControlTextCentered(this, y, string).setColor(getColor());
|
||||
y += 10;
|
||||
int maxBiomePerLine = (int) ((w() + 2.0f - 16.0f) / 18.0f);
|
||||
float biomeListX = (w() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2.0f;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
for (ItemStack soilStack : products) {
|
||||
if (dx >= 18 * maxBiomePerLine) {
|
||||
dx = 0;
|
||||
dy += 18;
|
||||
}
|
||||
|
||||
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(soilStack);
|
||||
soilStack.stackSize = 1;
|
||||
ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null);
|
||||
if (fluid != null) {
|
||||
display.addTooltip(fluid.getLocalizedName());
|
||||
}
|
||||
dx += 18;
|
||||
}
|
||||
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(soilStack);
|
||||
soilStack.stackSize = 1;
|
||||
ControlItemDisplay display =
|
||||
new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null);
|
||||
if (fluid != null) {
|
||||
display.addTooltip(fluid.getLocalizedName());
|
||||
}
|
||||
dx += 18;
|
||||
}
|
||||
|
||||
if (dx != 0) {
|
||||
dy += 18;
|
||||
}
|
||||
return y + dy;
|
||||
}
|
||||
if (dx != 0) {
|
||||
dy += 18;
|
||||
}
|
||||
return y + dy;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,10 @@ import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -24,183 +28,188 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AnalystPageProducts extends AnalystPageProduce {
|
||||
public AnalystPageProducts(IWidget parent, IArea area, IBee ind) {
|
||||
super(parent, area);
|
||||
setColor(0xcc3300);
|
||||
IBeeGenome genome = ind.getGenome();
|
||||
float speed = genome.getSpeed();
|
||||
float modeSpeed = Binnie.Genetics.getBeeRoot().getBeekeepingMode(BinnieCore.proxy.getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
public AnalystPageProducts(IWidget parent, IArea area, IBee ind) {
|
||||
super(parent, area);
|
||||
setColor(0xcc3300);
|
||||
IBeeGenome genome = ind.getGenome();
|
||||
float speed = genome.getSpeed();
|
||||
float modeSpeed = Binnie.Genetics.getBeeRoot()
|
||||
.getBeekeepingMode(BinnieCore.proxy.getWorld())
|
||||
.getBeeModifier()
|
||||
.getProductionModifier(genome, 1.0f);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
String alleleName = Binnie.Genetics.beeBreedingSystem.getAlleleName(EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED));
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.produce.rate", alleleName))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
String alleleName = Binnie.Genetics.beeBreedingSystem.getAlleleName(
|
||||
EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED));
|
||||
new ControlTextCentered(
|
||||
this,
|
||||
y,
|
||||
EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.produce.rate", alleleName))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 20;
|
||||
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
|
||||
Collection<ItemStack> productList = new UniqueItemStackSet();
|
||||
Map<ItemStack, Float> products = new HashMap<>();
|
||||
products.putAll(genome.getPrimary().getProductChances());
|
||||
products.putAll(genome.getSecondary().getProductChances());
|
||||
if (!products.isEmpty()) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.produce.natural"))
|
||||
.setColor(getColor());
|
||||
y += 20;
|
||||
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
|
||||
Collection<ItemStack> productList = new UniqueItemStackSet();
|
||||
Map<ItemStack, Float> products = new HashMap<>();
|
||||
products.putAll(genome.getPrimary().getProductChances());
|
||||
products.putAll(genome.getSecondary().getProductChances());
|
||||
if (!products.isEmpty()) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.produce.natural"))
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
for (Map.Entry<ItemStack, Float> entry : products.entrySet()) {
|
||||
if (!productList.add(entry.getKey())) {
|
||||
continue;
|
||||
}
|
||||
refinedProducts.addAll(getAllProducts(entry.getKey()));
|
||||
createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed);
|
||||
y += 18;
|
||||
}
|
||||
y += 12;
|
||||
}
|
||||
y += 12;
|
||||
for (Map.Entry<ItemStack, Float> entry : products.entrySet()) {
|
||||
if (!productList.add(entry.getKey())) {
|
||||
continue;
|
||||
}
|
||||
refinedProducts.addAll(getAllProducts(entry.getKey()));
|
||||
createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed);
|
||||
y += 18;
|
||||
}
|
||||
y += 12;
|
||||
}
|
||||
|
||||
products = genome.getPrimary().getSpecialtyChances();
|
||||
if (!products.isEmpty()) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.produce.speciality")).setColor(getColor());
|
||||
y += 12;
|
||||
for (Map.Entry<ItemStack, Float> entry : products.entrySet()) {
|
||||
refinedProducts.addAll(getAllProducts(entry.getKey()));
|
||||
createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed);
|
||||
y += 18;
|
||||
}
|
||||
y += 12;
|
||||
}
|
||||
products = genome.getPrimary().getSpecialtyChances();
|
||||
if (!products.isEmpty()) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.produce.speciality"))
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
for (Map.Entry<ItemStack, Float> entry : products.entrySet()) {
|
||||
refinedProducts.addAll(getAllProducts(entry.getKey()));
|
||||
createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed);
|
||||
y += 18;
|
||||
}
|
||||
y += 12;
|
||||
}
|
||||
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.produce.refined"))
|
||||
.setColor(getColor());
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.produce.refined")).setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
Collection<ItemStack> level2Products = new UniqueItemStackSet();
|
||||
for (ItemStack stack : refinedProducts) {
|
||||
level2Products.addAll(getAllProducts(stack));
|
||||
}
|
||||
y += 12;
|
||||
Collection<ItemStack> level2Products = new UniqueItemStackSet();
|
||||
for (ItemStack stack : refinedProducts) {
|
||||
level2Products.addAll(getAllProducts(stack));
|
||||
}
|
||||
|
||||
refinedProducts.addAll(level2Products);
|
||||
level2Products = new UniqueItemStackSet();
|
||||
for (ItemStack stack : refinedProducts) {
|
||||
level2Products.addAll(getAllProducts(stack));
|
||||
}
|
||||
refinedProducts.addAll(level2Products);
|
||||
level2Products = new UniqueItemStackSet();
|
||||
for (ItemStack stack : refinedProducts) {
|
||||
level2Products.addAll(getAllProducts(stack));
|
||||
}
|
||||
|
||||
refinedProducts.addAll(level2Products);
|
||||
Collection<FluidStack> allFluids = new ArrayList<>();
|
||||
for (ItemStack stack2 : refinedProducts) {
|
||||
for (FluidStack addition : getAllFluids(stack2)) {
|
||||
boolean alreadyIn = false;
|
||||
for (FluidStack existing : allFluids) {
|
||||
if (existing.isFluidEqual(addition)) {
|
||||
alreadyIn = true;
|
||||
}
|
||||
}
|
||||
if (!alreadyIn) {
|
||||
allFluids.add(addition);
|
||||
}
|
||||
}
|
||||
}
|
||||
refinedProducts.addAll(level2Products);
|
||||
Collection<FluidStack> allFluids = new ArrayList<>();
|
||||
for (ItemStack stack2 : refinedProducts) {
|
||||
for (FluidStack addition : getAllFluids(stack2)) {
|
||||
boolean alreadyIn = false;
|
||||
for (FluidStack existing : allFluids) {
|
||||
if (existing.isFluidEqual(addition)) {
|
||||
alreadyIn = true;
|
||||
}
|
||||
}
|
||||
if (!alreadyIn) {
|
||||
allFluids.add(addition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int maxBiomePerLine = (int) ((w() + 2.0f - 16.0f) / 18.0f);
|
||||
float biomeListX = (w() - (Math.min(maxBiomePerLine, allFluids.size() + refinedProducts.size()) * 18 - 2)) / 2.0f;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
for (ItemStack soilStack : refinedProducts) {
|
||||
if (dx >= 18 * maxBiomePerLine) {
|
||||
dx = 0;
|
||||
dy += 18;
|
||||
}
|
||||
ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy);
|
||||
display.setItemStack(soilStack);
|
||||
display.setTooltip();
|
||||
dx += 18;
|
||||
}
|
||||
int maxBiomePerLine = (int) ((w() + 2.0f - 16.0f) / 18.0f);
|
||||
float biomeListX =
|
||||
(w() - (Math.min(maxBiomePerLine, allFluids.size() + refinedProducts.size()) * 18 - 2)) / 2.0f;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
for (ItemStack soilStack : refinedProducts) {
|
||||
if (dx >= 18 * maxBiomePerLine) {
|
||||
dx = 0;
|
||||
dy += 18;
|
||||
}
|
||||
ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy);
|
||||
display.setItemStack(soilStack);
|
||||
display.setTooltip();
|
||||
dx += 18;
|
||||
}
|
||||
|
||||
for (FluidStack soilStack2 : allFluids) {
|
||||
if (dx >= 18 * maxBiomePerLine) {
|
||||
dx = 0;
|
||||
dy += 18;
|
||||
}
|
||||
for (FluidStack soilStack2 : allFluids) {
|
||||
if (dx >= 18 * maxBiomePerLine) {
|
||||
dx = 0;
|
||||
dy += 18;
|
||||
}
|
||||
|
||||
ItemStack container = null;
|
||||
for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
if (data.emptyContainer.isItemEqual(new ItemStack(Items.glass_bottle)) && data.fluid.isFluidEqual(soilStack2)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
ItemStack container = null;
|
||||
for (FluidContainerRegistry.FluidContainerData data :
|
||||
FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
if (data.emptyContainer.isItemEqual(new ItemStack(Items.glass_bottle))
|
||||
&& data.fluid.isFluidEqual(soilStack2)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
|
||||
if (data.emptyContainer.isItemEqual(new ItemStack(Items.bucket)) && data.fluid.isFluidEqual(soilStack2)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
if (data.emptyContainer.isItemEqual(new ItemStack(Items.bucket))
|
||||
&& data.fluid.isFluidEqual(soilStack2)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
|
||||
if (data.fluid.isFluidEqual(soilStack2)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (data.fluid.isFluidEqual(soilStack2)) {
|
||||
container = data.filledContainer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (container == null) {
|
||||
ControlFluidDisplay display2 = new ControlFluidDisplay(this, biomeListX + dx, y + dy);
|
||||
display2.setItemStack(soilStack2);
|
||||
display2.setTooltip();
|
||||
} else {
|
||||
ControlItemDisplay display3 = new ControlItemDisplay(this, biomeListX + dx, y + dy);
|
||||
display3.setItemStack(container);
|
||||
display3.setTooltip();
|
||||
}
|
||||
dx += 18;
|
||||
}
|
||||
setSize(new IPoint(w(), y + dy + 18 + 8));
|
||||
}
|
||||
if (container == null) {
|
||||
ControlFluidDisplay display2 = new ControlFluidDisplay(this, biomeListX + dx, y + dy);
|
||||
display2.setItemStack(soilStack2);
|
||||
display2.setTooltip();
|
||||
} else {
|
||||
ControlItemDisplay display3 = new ControlItemDisplay(this, biomeListX + dx, y + dy);
|
||||
display3.setItemStack(container);
|
||||
display3.setTooltip();
|
||||
}
|
||||
dx += 18;
|
||||
}
|
||||
setSize(new IPoint(w(), y + dy + 18 + 8));
|
||||
}
|
||||
|
||||
private void createProductEntry(ItemStack key, Float value, int y, float speed) {
|
||||
ControlItemDisplay item = new ControlItemDisplay(this, 16.0f, y) {
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
super.getTooltip(tooltip);
|
||||
Collection<ItemStack> products = getCentrifuge(key);
|
||||
if (!products.isEmpty()) {
|
||||
tooltip.add(I18N.localise("genetics.gui.analyst.produce.centrifuge") + " ");
|
||||
for (ItemStack prod : products) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
prod.writeToNBT(nbt);
|
||||
tooltip.add(prod, prod.getDisplayName());
|
||||
}
|
||||
}
|
||||
private void createProductEntry(ItemStack key, Float value, int y, float speed) {
|
||||
ControlItemDisplay item = new ControlItemDisplay(this, 16.0f, y) {
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
super.getTooltip(tooltip);
|
||||
Collection<ItemStack> products = getCentrifuge(key);
|
||||
if (!products.isEmpty()) {
|
||||
tooltip.add(I18N.localise("genetics.gui.analyst.produce.centrifuge") + " ");
|
||||
for (ItemStack prod : products) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
prod.writeToNBT(nbt);
|
||||
tooltip.add(prod, prod.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
Collection<ItemStack> liquids = getSqueezer(key);
|
||||
if (!liquids.isEmpty()) {
|
||||
tooltip.add(I18N.localise("genetics.gui.analyst.produce.squeezes") + " ");
|
||||
for (ItemStack prod2 : liquids) {
|
||||
NBTTagCompound nbt2 = new NBTTagCompound();
|
||||
prod2.writeToNBT(nbt2);
|
||||
tooltip.add(prod2, prod2.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Collection<ItemStack> liquids = getSqueezer(key);
|
||||
if (!liquids.isEmpty()) {
|
||||
tooltip.add(I18N.localise("genetics.gui.analyst.produce.squeezes") + " ");
|
||||
for (ItemStack prod2 : liquids) {
|
||||
NBTTagCompound nbt2 = new NBTTagCompound();
|
||||
prod2.writeToNBT(nbt2);
|
||||
tooltip.add(prod2, prod2.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
item.setTooltip();
|
||||
ControlText textWidget = new ControlTextCentered(this, y + 4, "");
|
||||
textWidget.setColor(getColor());
|
||||
CraftGUIUtil.moveWidget(textWidget, new IPoint(12.0f, 0.0f));
|
||||
item.setItemStack(key);
|
||||
float time = (int) (PluginApiculture.ticksPerBeeWorkCycle / (speed * value));
|
||||
textWidget.setValue(I18N.localise("genetics.gui.analyst.produce.everyTime", getTimeString(time)));
|
||||
}
|
||||
item.setTooltip();
|
||||
ControlText textWidget = new ControlTextCentered(this, y + 4, "");
|
||||
textWidget.setColor(getColor());
|
||||
CraftGUIUtil.moveWidget(textWidget, new IPoint(12.0f, 0.0f));
|
||||
item.setItemStack(key);
|
||||
float time = (int) (PluginApiculture.ticksPerBeeWorkCycle / (speed * value));
|
||||
textWidget.setValue(I18N.localise("genetics.gui.analyst.produce.everyTime", getTimeString(time)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.produce");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.produce");
|
||||
}
|
||||
}
|
||||
@@ -15,139 +15,157 @@ import binnie.core.genetics.Tolerance;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.genetics.genetics.AlleleHelper;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class AnalystPageSoil extends ControlAnalystPage {
|
||||
public AnalystPageSoil(IWidget parent, IArea area, IFlower flower) {
|
||||
super(parent, area);
|
||||
setColor(0x663300);
|
||||
EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture();
|
||||
EnumTolerance moistureTol = flower.getGenome().getToleranceMoisture();
|
||||
EnumAcidity pH = flower.getGenome().getPrimary().getPH();
|
||||
EnumTolerance pHTol = flower.getGenome().getTolerancePH();
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
public AnalystPageSoil(IWidget parent, IArea area, IFlower flower) {
|
||||
super(parent, area);
|
||||
setColor(0x663300);
|
||||
EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture();
|
||||
EnumTolerance moistureTol = flower.getGenome().getToleranceMoisture();
|
||||
EnumAcidity pH = flower.getGenome().getPrimary().getPH();
|
||||
EnumTolerance pHTol = flower.getGenome().getTolerancePH();
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
|
||||
y += 16;
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.moistureTolerance"), TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
y += 16;
|
||||
new ControlText(
|
||||
this,
|
||||
new IArea(4.0f, y, w() - 8.0f, 14.0f),
|
||||
I18N.localise("genetics.gui.analyst.soil.moistureTolerance"),
|
||||
TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
createMoisture(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, moisture, moistureTol);
|
||||
y += 12;
|
||||
createMoisture(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, moisture, moistureTol);
|
||||
|
||||
y += 16;
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.pHTolerance"), TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
y += 16;
|
||||
new ControlText(
|
||||
this,
|
||||
new IArea(4.0f, y, w() - 8.0f, 14.0f),
|
||||
I18N.localise("genetics.gui.analyst.soil.pHTolerance"),
|
||||
TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
createAcidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, pH, pHTol);
|
||||
y += 12;
|
||||
createAcidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, pH, pHTol);
|
||||
|
||||
y += 16;
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.recommendedSoil"), TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
y += 16;
|
||||
new ControlText(
|
||||
this,
|
||||
new IArea(4.0f, y, w() - 8.0f, 14.0f),
|
||||
I18N.localise("genetics.gui.analyst.soil.recommendedSoil"),
|
||||
TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
EnumMoisture recomMoisture = EnumMoisture.NORMAL;
|
||||
boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol);
|
||||
boolean canTolDamp = Tolerance.canTolerate(moisture, EnumMoisture.DAMP, moistureTol);
|
||||
boolean canTolDry = Tolerance.canTolerate(moisture, EnumMoisture.DRY, moistureTol);
|
||||
if (canTolNormal) {
|
||||
if (canTolDamp && !canTolDry) {
|
||||
recomMoisture = EnumMoisture.DAMP;
|
||||
} else if (canTolDry && !canTolDamp) {
|
||||
recomMoisture = EnumMoisture.DRY;
|
||||
}
|
||||
} else {
|
||||
if (canTolDry) {
|
||||
recomMoisture = EnumMoisture.DRY;
|
||||
} else if (canTolDamp) {
|
||||
recomMoisture = EnumMoisture.DAMP;
|
||||
}
|
||||
}
|
||||
y += 12;
|
||||
EnumMoisture recomMoisture = EnumMoisture.NORMAL;
|
||||
boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol);
|
||||
boolean canTolDamp = Tolerance.canTolerate(moisture, EnumMoisture.DAMP, moistureTol);
|
||||
boolean canTolDry = Tolerance.canTolerate(moisture, EnumMoisture.DRY, moistureTol);
|
||||
if (canTolNormal) {
|
||||
if (canTolDamp && !canTolDry) {
|
||||
recomMoisture = EnumMoisture.DAMP;
|
||||
} else if (canTolDry && !canTolDamp) {
|
||||
recomMoisture = EnumMoisture.DRY;
|
||||
}
|
||||
} else {
|
||||
if (canTolDry) {
|
||||
recomMoisture = EnumMoisture.DRY;
|
||||
} else if (canTolDamp) {
|
||||
recomMoisture = EnumMoisture.DAMP;
|
||||
}
|
||||
}
|
||||
|
||||
EnumAcidity recomPH = EnumAcidity.NEUTRAL;
|
||||
boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.NEUTRAL, pHTol);
|
||||
boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.ACID, pHTol);
|
||||
boolean canTolAlkaline = Tolerance.canTolerate(pH, EnumAcidity.ALKALINE, pHTol);
|
||||
if (canTolNeutral) {
|
||||
if (canTolAcid && !canTolAlkaline) {
|
||||
recomPH = EnumAcidity.ACID;
|
||||
} else if (canTolAlkaline && !canTolAcid) {
|
||||
recomPH = EnumAcidity.ALKALINE;
|
||||
}
|
||||
} else {
|
||||
if (canTolAcid) {
|
||||
recomPH = EnumAcidity.ACID;
|
||||
}
|
||||
if (canTolAlkaline) {
|
||||
recomPH = EnumAcidity.ALKALINE;
|
||||
}
|
||||
}
|
||||
EnumAcidity recomPH = EnumAcidity.NEUTRAL;
|
||||
boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.NEUTRAL, pHTol);
|
||||
boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.ACID, pHTol);
|
||||
boolean canTolAlkaline = Tolerance.canTolerate(pH, EnumAcidity.ALKALINE, pHTol);
|
||||
if (canTolNeutral) {
|
||||
if (canTolAcid && !canTolAlkaline) {
|
||||
recomPH = EnumAcidity.ACID;
|
||||
} else if (canTolAlkaline && !canTolAcid) {
|
||||
recomPH = EnumAcidity.ALKALINE;
|
||||
}
|
||||
} else {
|
||||
if (canTolAcid) {
|
||||
recomPH = EnumAcidity.ACID;
|
||||
}
|
||||
if (canTolAlkaline) {
|
||||
recomPH = EnumAcidity.ALKALINE;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture));
|
||||
ControlItemDisplay recomSoil = new ControlItemDisplay(this, (w() - 24.0f) / 2.0f, y, 24.0f);
|
||||
recomSoil.setItemStack(stack);
|
||||
recomSoil.setTooltip();
|
||||
y += 32;
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.otherSoils"), TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture));
|
||||
ControlItemDisplay recomSoil = new ControlItemDisplay(this, (w() - 24.0f) / 2.0f, y, 24.0f);
|
||||
recomSoil.setItemStack(stack);
|
||||
recomSoil.setTooltip();
|
||||
y += 32;
|
||||
new ControlText(
|
||||
this,
|
||||
new IArea(4.0f, y, w() - 8.0f, 14.0f),
|
||||
I18N.localise("genetics.gui.analyst.soil.otherSoils"),
|
||||
TextJustification.MIDDLE_CENTER)
|
||||
.setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
List<ItemStack> stacks = new ArrayList<>();
|
||||
for (EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) {
|
||||
for (EnumMoisture b : EnumSet.range(EnumMoisture.DRY, EnumMoisture.DAMP)) {
|
||||
if (Tolerance.canTolerate(pH, a, pHTol) && Tolerance.canTolerate(moisture, b, moistureTol) && (a != recomPH || b != recomMoisture)) {
|
||||
stacks.add(new ItemStack(Botany.soil, 1, BlockSoil.getMeta(a, b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
y += 12;
|
||||
List<ItemStack> stacks = new ArrayList<>();
|
||||
for (EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) {
|
||||
for (EnumMoisture b : EnumSet.range(EnumMoisture.DRY, EnumMoisture.DAMP)) {
|
||||
if (Tolerance.canTolerate(pH, a, pHTol)
|
||||
&& Tolerance.canTolerate(moisture, b, moistureTol)
|
||||
&& (a != recomPH || b != recomMoisture)) {
|
||||
stacks.add(new ItemStack(Botany.soil, 1, BlockSoil.getMeta(a, b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float soilListWidth = 17 * stacks.size() - 1;
|
||||
float soilListX = (w() - soilListWidth) / 2.0f;
|
||||
int t = 0;
|
||||
for (ItemStack soilStack : stacks) {
|
||||
ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y);
|
||||
display.setItemStack(soilStack);
|
||||
display.setTooltip();
|
||||
}
|
||||
}
|
||||
float soilListWidth = 17 * stacks.size() - 1;
|
||||
float soilListX = (w() - soilListWidth) / 2.0f;
|
||||
int t = 0;
|
||||
for (ItemStack soilStack : stacks) {
|
||||
ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y);
|
||||
display.setItemStack(soilStack);
|
||||
display.setTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
protected void createMoisture(IWidget parent, float x, float y, float w, float h, EnumMoisture value, EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumMoisture>(parent, x, y, w, h, EnumMoisture.class) {
|
||||
@Override
|
||||
protected String getName(EnumMoisture value) {
|
||||
return AlleleHelper.toDisplay(value);
|
||||
}
|
||||
protected void createMoisture(
|
||||
IWidget parent, float x, float y, float w, float h, EnumMoisture value, EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumMoisture>(parent, x, y, w, h, EnumMoisture.class) {
|
||||
@Override
|
||||
protected String getName(EnumMoisture value) {
|
||||
return AlleleHelper.toDisplay(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColor(EnumMoisture value) {
|
||||
return (new int[]{0xccffcc, 0x66ccff, 0x3366ff})[value.ordinal()];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
}
|
||||
@Override
|
||||
protected int getColor(EnumMoisture value) {
|
||||
return (new int[] {0xccffcc, 0x66ccff, 0x3366ff})[value.ordinal()];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
}
|
||||
|
||||
protected void createAcidity(IWidget parent, float x, float y, float w, float h, EnumAcidity value, EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumAcidity>(parent, x, y, w, h, EnumAcidity.class) {
|
||||
@Override
|
||||
protected String getName(EnumAcidity value) {
|
||||
return AlleleHelper.toDisplay(value);
|
||||
}
|
||||
protected void createAcidity(
|
||||
IWidget parent, float x, float y, float w, float h, EnumAcidity value, EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumAcidity>(parent, x, y, w, h, EnumAcidity.class) {
|
||||
@Override
|
||||
protected String getName(EnumAcidity value) {
|
||||
return AlleleHelper.toDisplay(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColor(EnumAcidity value) {
|
||||
return (new int[]{0xff0066, 0x00ff00, 0x0066ff})[value.ordinal()];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
}
|
||||
@Override
|
||||
protected int getColor(EnumAcidity value) {
|
||||
return (new int[] {0xff0066, 0x00ff00, 0x0066ff})[value.ordinal()];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.soil");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.soil");
|
||||
}
|
||||
}
|
||||
@@ -8,20 +8,19 @@ import forestry.api.lepidopterology.IButterfly;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class AnalystPageSpecimen extends ControlAnalystPage {
|
||||
public AnalystPageSpecimen(IWidget parent, IArea area, IButterfly ind) {
|
||||
super(parent, area);
|
||||
setColor(0x333333);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
public AnalystPageSpecimen(IWidget parent, IArea area, IButterfly ind) {
|
||||
super(parent, area);
|
||||
setColor(0x333333);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
|
||||
y += 12;
|
||||
float w = (w() - 16.0f) * ind.getSize();
|
||||
new ControlIndividualDisplay(this, (w() - w) / 2.0f, y + (w() - w) / 2.0f, w, ind);
|
||||
}
|
||||
y += 12;
|
||||
float w = (w() - 16.0f) * ind.getSize();
|
||||
new ControlIndividualDisplay(this, (w() - w) / 2.0f, y + (w() - w) / 2.0f, w, ind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.specimen");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.specimen");
|
||||
}
|
||||
}
|
||||
@@ -14,77 +14,73 @@ import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.genetics.IAlleleBoolean;
|
||||
import java.util.Collection;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class AnalystPageWood extends AnalystPageProduce {
|
||||
public AnalystPageWood(IWidget parent, IArea area, ITree ind) {
|
||||
super(parent, area);
|
||||
setColor(0x663300);
|
||||
ITreeGenome genome = ind.getGenome();
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
|
||||
.setColor(getColor());
|
||||
y += 12;
|
||||
public AnalystPageWood(IWidget parent, IArea area, ITree ind) {
|
||||
super(parent, area);
|
||||
setColor(0x663300);
|
||||
ITreeGenome genome = ind.getGenome();
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 12;
|
||||
|
||||
if (((IAlleleBoolean) ind.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF)).getValue()) {
|
||||
new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconNoFire.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.wood.fireproof"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconFire.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.wood.flammable"));
|
||||
}
|
||||
y += 30;
|
||||
Collection<ItemStack> products = new UniqueItemStackSet();
|
||||
if (((IAlleleBoolean) ind.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF)).getValue()) {
|
||||
new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconNoFire.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.wood.fireproof"));
|
||||
} else {
|
||||
new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconFire.getIcon())
|
||||
.addTooltip(I18N.localise("genetics.gui.analyst.wood.flammable"));
|
||||
}
|
||||
y += 30;
|
||||
Collection<ItemStack> products = new UniqueItemStackSet();
|
||||
|
||||
genome.getPrimary().getGenerator().setLogBlock(genome, FakeWorld.instance, 0, 0, 0, ForgeDirection.UP);
|
||||
ItemStack stackWood = FakeWorld.instance.getWooLog();
|
||||
if (stackWood != null) {
|
||||
products.add(stackWood);
|
||||
}
|
||||
genome.getPrimary().getGenerator().setLogBlock(genome, FakeWorld.instance, 0, 0, 0, ForgeDirection.UP);
|
||||
ItemStack stackWood = FakeWorld.instance.getWooLog();
|
||||
if (stackWood != null) {
|
||||
products.add(stackWood);
|
||||
}
|
||||
|
||||
// for (ItemStack stack :
|
||||
// ind.getGenome().getFruitProvider().getProducts()) {
|
||||
// products.add(stack);
|
||||
// }
|
||||
// for (ItemStack stack :
|
||||
// ind.getGenome().getFruitProvider().getProducts()) {
|
||||
// products.add(stack);
|
||||
// }
|
||||
|
||||
if (products.size() > 0) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.logs"))
|
||||
.setColor(getColor());
|
||||
y += 10;
|
||||
int w = products.size() * 18 - 2;
|
||||
int i = 0;
|
||||
for (ItemStack stack : products) {
|
||||
ControlItemDisplay d = new ControlItemDisplay(this, (w() - w) / 2.0f + 18 * i, y);
|
||||
d.setTooltip();
|
||||
d.setItemStack(stack);
|
||||
}
|
||||
y += 26;
|
||||
}
|
||||
if (products.size() > 0) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.logs")).setColor(getColor());
|
||||
y += 10;
|
||||
int w = products.size() * 18 - 2;
|
||||
int i = 0;
|
||||
for (ItemStack stack : products) {
|
||||
ControlItemDisplay d = new ControlItemDisplay(this, (w() - w) / 2.0f + 18 * i, y);
|
||||
d.setTooltip();
|
||||
d.setItemStack(stack);
|
||||
}
|
||||
y += 26;
|
||||
}
|
||||
|
||||
Collection<ItemStack> allProducts = new UniqueItemStackSet();
|
||||
allProducts.addAll(products);
|
||||
Collection<ItemStack> allProducts = new UniqueItemStackSet();
|
||||
allProducts.addAll(products);
|
||||
|
||||
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
|
||||
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
|
||||
if (refinedProducts.size() > 0) {
|
||||
y = getRefined(I18N.localise("genetics.gui.analyst.wood.products"), y, refinedProducts);
|
||||
y += 8;
|
||||
}
|
||||
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
|
||||
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
|
||||
if (refinedProducts.size() > 0) {
|
||||
y = getRefined(I18N.localise("genetics.gui.analyst.wood.products"), y, refinedProducts);
|
||||
y += 8;
|
||||
}
|
||||
|
||||
if (products.size() == 0) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.noFruits"))
|
||||
.setColor(getColor());
|
||||
y += 28;
|
||||
}
|
||||
setSize(new IPoint(w(), y + 8));
|
||||
}
|
||||
if (products.size() == 0) {
|
||||
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.noFruits")).setColor(getColor());
|
||||
y += 28;
|
||||
}
|
||||
setSize(new IPoint(w(), y + 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.wood");
|
||||
}
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise("genetics.gui.analyst.wood");
|
||||
}
|
||||
}
|
||||
@@ -18,43 +18,52 @@ import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public class ControlAnalystChromosome extends Control implements ITooltip {
|
||||
IAllele allele0;
|
||||
IAllele allele1;
|
||||
IChromosomeType chromosomeType;
|
||||
ISpeciesRoot root;
|
||||
Texture Homozygous;
|
||||
Texture Heterozygous;
|
||||
IAllele allele0;
|
||||
IAllele allele1;
|
||||
IChromosomeType chromosomeType;
|
||||
ISpeciesRoot root;
|
||||
Texture Homozygous;
|
||||
Texture Heterozygous;
|
||||
|
||||
public ControlAnalystChromosome(IWidget parent, float x, float y, ISpeciesRoot root, IChromosomeType type, IAllele allele0, IAllele allele1) {
|
||||
super(parent, x, y, 16.0f, 22.0f);
|
||||
Homozygous = new StandardTexture(0, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
|
||||
Heterozygous = new StandardTexture(16, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
this.root = root;
|
||||
chromosomeType = type;
|
||||
this.allele0 = allele0;
|
||||
this.allele1 = allele1;
|
||||
}
|
||||
public ControlAnalystChromosome(
|
||||
IWidget parent,
|
||||
float x,
|
||||
float y,
|
||||
ISpeciesRoot root,
|
||||
IChromosomeType type,
|
||||
IAllele allele0,
|
||||
IAllele allele1) {
|
||||
super(parent, x, y, 16.0f, 22.0f);
|
||||
Homozygous = new StandardTexture(0, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
|
||||
Heterozygous = new StandardTexture(16, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
this.root = root;
|
||||
chromosomeType = type;
|
||||
this.allele0 = allele0;
|
||||
this.allele1 = allele1;
|
||||
}
|
||||
|
||||
public boolean isHomozygous() {
|
||||
return allele0.getUID().equals(allele1.getUID());
|
||||
}
|
||||
public boolean isHomozygous() {
|
||||
return allele0.getUID().equals(allele1.getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
CraftGUI.render.texture(isHomozygous() ? Homozygous : Heterozygous, IPoint.ZERO);
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
CraftGUI.render.texture(isHomozygous() ? Homozygous : Heterozygous, IPoint.ZERO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(root);
|
||||
tooltip.add(system.getChromosomeName(chromosomeType));
|
||||
if (isHomozygous()) {
|
||||
tooltip.add(system.getAlleleName(chromosomeType, allele0));
|
||||
} else {
|
||||
tooltip.add(I18N.localise("genetics.gui.analyst.chromosome.active", system.getAlleleName(chromosomeType, allele0)));
|
||||
tooltip.add(I18N.localise("genetics.gui.analyst.chromosome.inactive", system.getAlleleName(chromosomeType, allele1)));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(root);
|
||||
tooltip.add(system.getChromosomeName(chromosomeType));
|
||||
if (isHomozygous()) {
|
||||
tooltip.add(system.getAlleleName(chromosomeType, allele0));
|
||||
} else {
|
||||
tooltip.add(I18N.localise(
|
||||
"genetics.gui.analyst.chromosome.active", system.getAlleleName(chromosomeType, allele0)));
|
||||
tooltip.add(I18N.localise(
|
||||
"genetics.gui.analyst.chromosome.inactive", system.getAlleleName(chromosomeType, allele1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,33 +4,32 @@ import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public abstract class ControlAnalystPage extends Control {
|
||||
public ControlAnalystPage(IWidget parent, IArea area) {
|
||||
super(parent, area);
|
||||
hide();
|
||||
}
|
||||
public ControlAnalystPage(IWidget parent, IArea area) {
|
||||
super(parent, area);
|
||||
hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
public abstract String getTitle();
|
||||
public abstract String getTitle();
|
||||
|
||||
protected String getTimeString(float time) {
|
||||
float seconds = time / 20.0f;
|
||||
float minutes = seconds / 60.0f;
|
||||
float hours = minutes / 60.0f;
|
||||
DecimalFormat df = new DecimalFormat("#.#");
|
||||
if (hours > 1.0f) {
|
||||
return I18N.localise("genetics.gui.analyst.page.hours", df.format(hours));
|
||||
}
|
||||
if (minutes > 1.0f) {
|
||||
return I18N.localise("genetics.gui.analyst.page.minutes", df.format(minutes));
|
||||
}
|
||||
return I18N.localise("genetics.gui.analyst.page.seconds", df.format(seconds));
|
||||
}
|
||||
protected String getTimeString(float time) {
|
||||
float seconds = time / 20.0f;
|
||||
float minutes = seconds / 60.0f;
|
||||
float hours = minutes / 60.0f;
|
||||
DecimalFormat df = new DecimalFormat("#.#");
|
||||
if (hours > 1.0f) {
|
||||
return I18N.localise("genetics.gui.analyst.page.hours", df.format(hours));
|
||||
}
|
||||
if (minutes > 1.0f) {
|
||||
return I18N.localise("genetics.gui.analyst.page.minutes", df.format(minutes));
|
||||
}
|
||||
return I18N.localise("genetics.gui.analyst.page.seconds", df.format(seconds));
|
||||
}
|
||||
}
|
||||
@@ -12,59 +12,59 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
public class ControlBiome extends Control implements ITooltip {
|
||||
BiomeGenBase biome;
|
||||
String iconCategory;
|
||||
BiomeGenBase biome;
|
||||
String iconCategory;
|
||||
|
||||
public ControlBiome(IWidget parent, float x, float y, float w, float h, BiomeGenBase biome) {
|
||||
super(parent, x, y, w, h);
|
||||
this.biome = null;
|
||||
iconCategory = "plains";
|
||||
this.biome = biome;
|
||||
}
|
||||
public ControlBiome(IWidget parent, float x, float y, float w, float h, BiomeGenBase biome) {
|
||||
super(parent, x, y, w, h);
|
||||
this.biome = null;
|
||||
iconCategory = "plains";
|
||||
this.biome = biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MOUNTAIN) ||
|
||||
BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.HILLS)) {
|
||||
iconCategory = "hills";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY)) {
|
||||
iconCategory = "desert";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
|
||||
iconCategory = "snow";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) {
|
||||
iconCategory = "forest";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SWAMP)) {
|
||||
iconCategory = "swamp";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.JUNGLE)) {
|
||||
iconCategory = "jungle";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.COLD) &&
|
||||
BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) {
|
||||
iconCategory = "taiga";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MUSHROOM)) {
|
||||
iconCategory = "mushroom";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.OCEAN)) {
|
||||
iconCategory = "ocean";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER)) {
|
||||
iconCategory = "nether";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END)) {
|
||||
iconCategory = "end";
|
||||
}
|
||||
IIcon icon = TextureManager.getInstance().getDefault("habitats/" + iconCategory);
|
||||
CraftGUI.render.iconItem(IPoint.ZERO, icon);
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MOUNTAIN)
|
||||
|| BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.HILLS)) {
|
||||
iconCategory = "hills";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY)) {
|
||||
iconCategory = "desert";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
|
||||
iconCategory = "snow";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) {
|
||||
iconCategory = "forest";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SWAMP)) {
|
||||
iconCategory = "swamp";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.JUNGLE)) {
|
||||
iconCategory = "jungle";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.COLD)
|
||||
&& BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) {
|
||||
iconCategory = "taiga";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MUSHROOM)) {
|
||||
iconCategory = "mushroom";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.OCEAN)) {
|
||||
iconCategory = "ocean";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER)) {
|
||||
iconCategory = "nether";
|
||||
}
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END)) {
|
||||
iconCategory = "end";
|
||||
}
|
||||
IIcon icon = TextureManager.getInstance().getDefault("habitats/" + iconCategory);
|
||||
CraftGUI.render.iconItem(IPoint.ZERO, icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(biome.biomeName.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2"));
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(biome.biomeName.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2"));
|
||||
}
|
||||
}
|
||||
@@ -15,42 +15,42 @@ import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
|
||||
public class ControlChromoPicker extends Control implements ITooltip {
|
||||
Texture Selected;
|
||||
Texture Texture;
|
||||
IChromosomeType type;
|
||||
ControlChromosome parent;
|
||||
Texture Selected;
|
||||
Texture Texture;
|
||||
IChromosomeType type;
|
||||
ControlChromosome parent;
|
||||
|
||||
public ControlChromoPicker(ControlChromosome parent, float x, float y, IChromosomeType chromo) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
Selected = new StandardTexture(160, 18, 16, 16, ExtraBeeTexture.GUIPunnett);
|
||||
Texture = new StandardTexture(160, 34, 16, 16, ExtraBeeTexture.GUIPunnett);
|
||||
type = chromo;
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
this.parent = parent;
|
||||
addSelfEventHandler(new EventWidget.StartMouseOver.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventWidget.StartMouseOver event) {
|
||||
callEvent(new EventValueChanged<Object>(getWidget(), type));
|
||||
}
|
||||
});
|
||||
addSelfEventHandler(new EventWidget.EndMouseOver.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventWidget.EndMouseOver event) {
|
||||
callEvent(new EventValueChanged<>(getWidget(), null));
|
||||
}
|
||||
});
|
||||
}
|
||||
public ControlChromoPicker(ControlChromosome parent, float x, float y, IChromosomeType chromo) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
Selected = new StandardTexture(160, 18, 16, 16, ExtraBeeTexture.GUIPunnett);
|
||||
Texture = new StandardTexture(160, 34, 16, 16, ExtraBeeTexture.GUIPunnett);
|
||||
type = chromo;
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
this.parent = parent;
|
||||
addSelfEventHandler(new EventWidget.StartMouseOver.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventWidget.StartMouseOver event) {
|
||||
callEvent(new EventValueChanged<Object>(getWidget(), type));
|
||||
}
|
||||
});
|
||||
addSelfEventHandler(new EventWidget.EndMouseOver.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventWidget.EndMouseOver event) {
|
||||
callEvent(new EventValueChanged<>(getWidget(), null));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
boolean selected = isMouseOver();
|
||||
Texture text = selected ? Selected : Texture;
|
||||
CraftGUI.render.texture(text, IPoint.ZERO);
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
boolean selected = isMouseOver();
|
||||
Texture text = selected ? Selected : Texture;
|
||||
CraftGUI.render.texture(text, IPoint.ZERO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(Binnie.Genetics.getSystem(parent.getRoot()).getChromosomeName(type));
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(Binnie.Genetics.getSystem(parent.getRoot()).getChromosomeName(type));
|
||||
}
|
||||
}
|
||||
@@ -17,124 +17,124 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
|
||||
public class ControlChromosome extends Control implements IControlValue<IChromosomeType> {
|
||||
Texture BeeTexture;
|
||||
Texture TreeTexture;
|
||||
Texture MothTexture;
|
||||
Texture FlowerTexture;
|
||||
IChromosomeType chromo;
|
||||
ISpeciesRoot species;
|
||||
Texture BeeTexture;
|
||||
Texture TreeTexture;
|
||||
Texture MothTexture;
|
||||
Texture FlowerTexture;
|
||||
IChromosomeType chromo;
|
||||
ISpeciesRoot species;
|
||||
|
||||
public ControlChromosome(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, 96.0f, 96.0f);
|
||||
BeeTexture = new StandardTexture(0, 0, 96, 96, BinnieCoreTexture.GUIBreeding);
|
||||
TreeTexture = new StandardTexture(96, 0, 96, 96, BinnieCoreTexture.GUIBreeding);
|
||||
MothTexture = new StandardTexture(96, 96, 96, 96, BinnieCoreTexture.GUIBreeding);
|
||||
FlowerTexture = new StandardTexture(0, 96, 96, 96, BinnieCoreTexture.GUIBreeding);
|
||||
chromo = null;
|
||||
species = null;
|
||||
}
|
||||
public ControlChromosome(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, 96.0f, 96.0f);
|
||||
BeeTexture = new StandardTexture(0, 0, 96, 96, BinnieCoreTexture.GUIBreeding);
|
||||
TreeTexture = new StandardTexture(96, 0, 96, 96, BinnieCoreTexture.GUIBreeding);
|
||||
MothTexture = new StandardTexture(96, 96, 96, 96, BinnieCoreTexture.GUIBreeding);
|
||||
FlowerTexture = new StandardTexture(0, 96, 96, 96, BinnieCoreTexture.GUIBreeding);
|
||||
chromo = null;
|
||||
species = null;
|
||||
}
|
||||
|
||||
public ISpeciesRoot getRoot() {
|
||||
return species;
|
||||
}
|
||||
public ISpeciesRoot getRoot() {
|
||||
return species;
|
||||
}
|
||||
|
||||
public void setRoot(ISpeciesRoot root) {
|
||||
if (root != species) {
|
||||
species = root;
|
||||
deleteAllChildren();
|
||||
if (root == Binnie.Genetics.getBeeRoot()) {
|
||||
new ControlChromoPicker(this, 28.0f, 47.0f, EnumBeeChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 28.0f, 72.0f, EnumBeeChromosome.SPEED);
|
||||
new ControlChromoPicker(this, 19.0f, 20.0f, EnumBeeChromosome.LIFESPAN);
|
||||
new ControlChromoPicker(this, 55.0f, 65.0f, EnumBeeChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 28.0f, 1.0f, EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
new ControlChromoPicker(this, 61.0f, 37.0f, EnumBeeChromosome.NOCTURNAL);
|
||||
new ControlChromoPicker(this, 81.0f, 76.0f, EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
new ControlChromoPicker(this, 44.0f, 21.0f, EnumBeeChromosome.TOLERANT_FLYER);
|
||||
new ControlChromoPicker(this, 3.0f, 37.0f, EnumBeeChromosome.CAVE_DWELLING);
|
||||
new ControlChromoPicker(this, 4.0f, 65.0f, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
new ControlChromoPicker(this, 83.0f, 27.0f, EnumBeeChromosome.FLOWERING);
|
||||
new ControlChromoPicker(this, 71.0f, 10.0f, EnumBeeChromosome.TERRITORY);
|
||||
new ControlChromoPicker(this, 84.0f, 54.0f, EnumBeeChromosome.EFFECT);
|
||||
} else if (root == Binnie.Genetics.getTreeRoot()) {
|
||||
new ControlChromoPicker(this, 48.0f, 48.0f, EnumTreeChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 43.0f, 12.0f, EnumTreeChromosome.GROWTH);
|
||||
new ControlChromoPicker(this, 43.0f, 84.0f, EnumTreeChromosome.HEIGHT);
|
||||
new ControlChromoPicker(this, 25.0f, 63.0f, EnumTreeChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 72.0f, 57.0f, EnumTreeChromosome.FRUITS);
|
||||
new ControlChromoPicker(this, 21.0f, 43.0f, EnumTreeChromosome.YIELD);
|
||||
new ControlChromoPicker(this, 38.0f, 32.0f, EnumTreeChromosome.PLANT);
|
||||
new ControlChromoPicker(this, 15.0f, 17.0f, EnumTreeChromosome.SAPPINESS);
|
||||
new ControlChromoPicker(this, 75.0f, 78.0f, EnumTreeChromosome.TERRITORY);
|
||||
new ControlChromoPicker(this, 67.0f, 15.0f, EnumTreeChromosome.EFFECT);
|
||||
new ControlChromoPicker(this, 70.0f, 34.0f, EnumTreeChromosome.MATURATION);
|
||||
new ControlChromoPicker(this, 45.0f, 67.0f, EnumTreeChromosome.GIRTH);
|
||||
new ControlChromoPicker(this, 5.0f, 70.0f, EnumTreeChromosome.FIREPROOF);
|
||||
} else if (root == Binnie.Genetics.getFlowerRoot()) {
|
||||
new ControlChromoPicker(this, 35.0f, 81.0f, EnumFlowerChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 36.0f, 28.0f, EnumFlowerChromosome.PRIMARY);
|
||||
new ControlChromoPicker(this, 27.0f, 13.0f, EnumFlowerChromosome.SECONDARY);
|
||||
new ControlChromoPicker(this, 47.0f, 15.0f, EnumFlowerChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 54.0f, 31.0f, EnumFlowerChromosome.TERRITORY);
|
||||
new ControlChromoPicker(this, 15.0f, 55.0f, EnumFlowerChromosome.EFFECT);
|
||||
new ControlChromoPicker(this, 23.0f, 38.0f, EnumFlowerChromosome.LIFESPAN);
|
||||
new ControlChromoPicker(this, 17.0f, 77.0f, EnumFlowerChromosome.TEMPERATURE_TOLERANCE);
|
||||
new ControlChromoPicker(this, 52.0f, 51.0f, EnumFlowerChromosome.HUMIDITY_TOLERANCE);
|
||||
new ControlChromoPicker(this, 54.0f, 80.0f, EnumFlowerChromosome.PH_TOLERANCE);
|
||||
new ControlChromoPicker(this, 41.0f, 42.0f, EnumFlowerChromosome.SAPPINESS);
|
||||
new ControlChromoPicker(this, 37.0f, 63.0f, EnumFlowerChromosome.STEM);
|
||||
} else if (root == Binnie.Genetics.getButterflyRoot()) {
|
||||
new ControlChromoPicker(this, 40.0f, 40.0f, EnumButterflyChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 63.0f, 32.0f, EnumButterflyChromosome.SIZE);
|
||||
new ControlChromoPicker(this, 32.0f, 63.0f, EnumButterflyChromosome.SPEED);
|
||||
new ControlChromoPicker(this, 11.0f, 27.0f, EnumButterflyChromosome.LIFESPAN);
|
||||
new ControlChromoPicker(this, 16.0f, 12.0f, EnumButterflyChromosome.METABOLISM);
|
||||
new ControlChromoPicker(this, 17.0f, 63.0f, EnumButterflyChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 34.0f, 12.0f, EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
|
||||
new ControlChromoPicker(this, 22.0f, 46.0f, EnumButterflyChromosome.HUMIDITY_TOLERANCE);
|
||||
new ControlChromoPicker(this, 53.0f, 26.0f, EnumButterflyChromosome.NOCTURNAL);
|
||||
new ControlChromoPicker(this, 71.0f, 53.0f, EnumButterflyChromosome.TOLERANT_FLYER);
|
||||
new ControlChromoPicker(this, 78.0f, 12.0f, EnumButterflyChromosome.FIRE_RESIST);
|
||||
new ControlChromoPicker(this, 55.0f, 55.0f, EnumButterflyChromosome.FLOWER_PROVIDER);
|
||||
new ControlChromoPicker(this, 27.0f, 31.0f, EnumButterflyChromosome.EFFECT);
|
||||
new ControlChromoPicker(this, 87.0f, 45.0f, EnumButterflyChromosome.TERRITORY);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void setRoot(ISpeciesRoot root) {
|
||||
if (root != species) {
|
||||
species = root;
|
||||
deleteAllChildren();
|
||||
if (root == Binnie.Genetics.getBeeRoot()) {
|
||||
new ControlChromoPicker(this, 28.0f, 47.0f, EnumBeeChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 28.0f, 72.0f, EnumBeeChromosome.SPEED);
|
||||
new ControlChromoPicker(this, 19.0f, 20.0f, EnumBeeChromosome.LIFESPAN);
|
||||
new ControlChromoPicker(this, 55.0f, 65.0f, EnumBeeChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 28.0f, 1.0f, EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
new ControlChromoPicker(this, 61.0f, 37.0f, EnumBeeChromosome.NOCTURNAL);
|
||||
new ControlChromoPicker(this, 81.0f, 76.0f, EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
new ControlChromoPicker(this, 44.0f, 21.0f, EnumBeeChromosome.TOLERANT_FLYER);
|
||||
new ControlChromoPicker(this, 3.0f, 37.0f, EnumBeeChromosome.CAVE_DWELLING);
|
||||
new ControlChromoPicker(this, 4.0f, 65.0f, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
new ControlChromoPicker(this, 83.0f, 27.0f, EnumBeeChromosome.FLOWERING);
|
||||
new ControlChromoPicker(this, 71.0f, 10.0f, EnumBeeChromosome.TERRITORY);
|
||||
new ControlChromoPicker(this, 84.0f, 54.0f, EnumBeeChromosome.EFFECT);
|
||||
} else if (root == Binnie.Genetics.getTreeRoot()) {
|
||||
new ControlChromoPicker(this, 48.0f, 48.0f, EnumTreeChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 43.0f, 12.0f, EnumTreeChromosome.GROWTH);
|
||||
new ControlChromoPicker(this, 43.0f, 84.0f, EnumTreeChromosome.HEIGHT);
|
||||
new ControlChromoPicker(this, 25.0f, 63.0f, EnumTreeChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 72.0f, 57.0f, EnumTreeChromosome.FRUITS);
|
||||
new ControlChromoPicker(this, 21.0f, 43.0f, EnumTreeChromosome.YIELD);
|
||||
new ControlChromoPicker(this, 38.0f, 32.0f, EnumTreeChromosome.PLANT);
|
||||
new ControlChromoPicker(this, 15.0f, 17.0f, EnumTreeChromosome.SAPPINESS);
|
||||
new ControlChromoPicker(this, 75.0f, 78.0f, EnumTreeChromosome.TERRITORY);
|
||||
new ControlChromoPicker(this, 67.0f, 15.0f, EnumTreeChromosome.EFFECT);
|
||||
new ControlChromoPicker(this, 70.0f, 34.0f, EnumTreeChromosome.MATURATION);
|
||||
new ControlChromoPicker(this, 45.0f, 67.0f, EnumTreeChromosome.GIRTH);
|
||||
new ControlChromoPicker(this, 5.0f, 70.0f, EnumTreeChromosome.FIREPROOF);
|
||||
} else if (root == Binnie.Genetics.getFlowerRoot()) {
|
||||
new ControlChromoPicker(this, 35.0f, 81.0f, EnumFlowerChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 36.0f, 28.0f, EnumFlowerChromosome.PRIMARY);
|
||||
new ControlChromoPicker(this, 27.0f, 13.0f, EnumFlowerChromosome.SECONDARY);
|
||||
new ControlChromoPicker(this, 47.0f, 15.0f, EnumFlowerChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 54.0f, 31.0f, EnumFlowerChromosome.TERRITORY);
|
||||
new ControlChromoPicker(this, 15.0f, 55.0f, EnumFlowerChromosome.EFFECT);
|
||||
new ControlChromoPicker(this, 23.0f, 38.0f, EnumFlowerChromosome.LIFESPAN);
|
||||
new ControlChromoPicker(this, 17.0f, 77.0f, EnumFlowerChromosome.TEMPERATURE_TOLERANCE);
|
||||
new ControlChromoPicker(this, 52.0f, 51.0f, EnumFlowerChromosome.HUMIDITY_TOLERANCE);
|
||||
new ControlChromoPicker(this, 54.0f, 80.0f, EnumFlowerChromosome.PH_TOLERANCE);
|
||||
new ControlChromoPicker(this, 41.0f, 42.0f, EnumFlowerChromosome.SAPPINESS);
|
||||
new ControlChromoPicker(this, 37.0f, 63.0f, EnumFlowerChromosome.STEM);
|
||||
} else if (root == Binnie.Genetics.getButterflyRoot()) {
|
||||
new ControlChromoPicker(this, 40.0f, 40.0f, EnumButterflyChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 63.0f, 32.0f, EnumButterflyChromosome.SIZE);
|
||||
new ControlChromoPicker(this, 32.0f, 63.0f, EnumButterflyChromosome.SPEED);
|
||||
new ControlChromoPicker(this, 11.0f, 27.0f, EnumButterflyChromosome.LIFESPAN);
|
||||
new ControlChromoPicker(this, 16.0f, 12.0f, EnumButterflyChromosome.METABOLISM);
|
||||
new ControlChromoPicker(this, 17.0f, 63.0f, EnumButterflyChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 34.0f, 12.0f, EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
|
||||
new ControlChromoPicker(this, 22.0f, 46.0f, EnumButterflyChromosome.HUMIDITY_TOLERANCE);
|
||||
new ControlChromoPicker(this, 53.0f, 26.0f, EnumButterflyChromosome.NOCTURNAL);
|
||||
new ControlChromoPicker(this, 71.0f, 53.0f, EnumButterflyChromosome.TOLERANT_FLYER);
|
||||
new ControlChromoPicker(this, 78.0f, 12.0f, EnumButterflyChromosome.FIRE_RESIST);
|
||||
new ControlChromoPicker(this, 55.0f, 55.0f, EnumButterflyChromosome.FLOWER_PROVIDER);
|
||||
new ControlChromoPicker(this, 27.0f, 31.0f, EnumButterflyChromosome.EFFECT);
|
||||
new ControlChromoPicker(this, 87.0f, 45.0f, EnumButterflyChromosome.TERRITORY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType getValue() {
|
||||
return chromo;
|
||||
}
|
||||
@Override
|
||||
public IChromosomeType getValue() {
|
||||
return chromo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(IChromosomeType value) {
|
||||
chromo = value;
|
||||
}
|
||||
@Override
|
||||
public void setValue(IChromosomeType value) {
|
||||
chromo = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (species == null) {
|
||||
return;
|
||||
}
|
||||
super.onRenderBackground();
|
||||
Texture text = getTypeTexture();
|
||||
CraftGUI.render.texture(text, IPoint.ZERO);
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (species == null) {
|
||||
return;
|
||||
}
|
||||
super.onRenderBackground();
|
||||
Texture text = getTypeTexture();
|
||||
CraftGUI.render.texture(text, IPoint.ZERO);
|
||||
}
|
||||
|
||||
private Texture getTypeTexture() {
|
||||
if (species == Binnie.Genetics.getBeeRoot()) {
|
||||
return BeeTexture;
|
||||
}
|
||||
if (species == Binnie.Genetics.getTreeRoot()) {
|
||||
return TreeTexture;
|
||||
}
|
||||
if (species == Binnie.Genetics.getButterflyRoot()) {
|
||||
return MothTexture;
|
||||
}
|
||||
if (species == Binnie.Genetics.getFlowerRoot()) {
|
||||
return FlowerTexture;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private Texture getTypeTexture() {
|
||||
if (species == Binnie.Genetics.getBeeRoot()) {
|
||||
return BeeTexture;
|
||||
}
|
||||
if (species == Binnie.Genetics.getTreeRoot()) {
|
||||
return TreeTexture;
|
||||
}
|
||||
if (species == Binnie.Genetics.getButterflyRoot()) {
|
||||
return MothTexture;
|
||||
}
|
||||
if (species == Binnie.Genetics.getFlowerRoot()) {
|
||||
return FlowerTexture;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -8,23 +8,25 @@ import binnie.core.craftgui.geometry.TextJustification;
|
||||
import binnie.core.genetics.Gene;
|
||||
|
||||
public class ControlGenesisOption extends ControlOption<Gene> {
|
||||
public ControlGenesisOption(ControlList<Gene> parent, Gene gene, int y) {
|
||||
super(parent, gene, y);
|
||||
}
|
||||
public ControlGenesisOption(ControlList<Gene> parent, Gene gene, int y) {
|
||||
super(parent, gene, y);
|
||||
}
|
||||
|
||||
String getAlleleName() {
|
||||
return getValue().getAlleleName();
|
||||
}
|
||||
String getAlleleName() {
|
||||
return getValue().getAlleleName();
|
||||
}
|
||||
|
||||
String getChromosomeName() {
|
||||
return getValue().getShortChromosomeName();
|
||||
}
|
||||
String getChromosomeName() {
|
||||
return getValue().getShortChromosomeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
CraftGUI.render.text(new IArea(0.0f, 0.0f, 70.0f, 22.0f), TextJustification.MIDDLE_CENTER, getChromosomeName(), getColor());
|
||||
CraftGUI.render.text(new IArea(75.0f, 0.0f, 80.0f, 22.0f), TextJustification.MIDDLE_CENTER, getAlleleName(), getColor());
|
||||
CraftGUI.render.solid(new IArea(70.0f, 2.0f, 1.0f, 16.0f), 0xff000000 + getColor());
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
CraftGUI.render.text(
|
||||
new IArea(0.0f, 0.0f, 70.0f, 22.0f), TextJustification.MIDDLE_CENTER, getChromosomeName(), getColor());
|
||||
CraftGUI.render.text(
|
||||
new IArea(75.0f, 0.0f, 80.0f, 22.0f), TextJustification.MIDDLE_CENTER, getAlleleName(), getColor());
|
||||
CraftGUI.render.solid(new IArea(70.0f, 2.0f, 1.0f, 16.0f), 0xff000000 + getColor());
|
||||
}
|
||||
}
|
||||
@@ -11,28 +11,28 @@ import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ControlIndividualDisplay extends ControlItemDisplay implements ITooltip {
|
||||
public ControlIndividualDisplay(IWidget parent, float x, float y, IIndividual ind) {
|
||||
this(parent, x, y, 16.0f, ind);
|
||||
}
|
||||
public ControlIndividualDisplay(IWidget parent, float x, float y, IIndividual ind) {
|
||||
this(parent, x, y, 16.0f, ind);
|
||||
}
|
||||
|
||||
public ControlIndividualDisplay(IWidget parent, float x, float y, float size, IIndividual ind) {
|
||||
super(parent, x, y, size);
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
|
||||
setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()));
|
||||
setTooltip();
|
||||
}
|
||||
public ControlIndividualDisplay(IWidget parent, float x, float y, float size, IIndividual ind) {
|
||||
super(parent, x, y, size);
|
||||
BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
|
||||
setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()));
|
||||
setTooltip();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
ItemStack stack = getItemStack();
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
ItemStack stack = getItemStack();
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
if (ind == null) {
|
||||
return;
|
||||
}
|
||||
tooltip.add(ind.getGenome().getPrimary().getName());
|
||||
}
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
if (ind == null) {
|
||||
return;
|
||||
}
|
||||
tooltip.add(ind.getGenome().getPrimary().getName());
|
||||
}
|
||||
}
|
||||
@@ -11,65 +11,64 @@ import binnie.core.craftgui.geometry.IBorder;
|
||||
import binnie.core.genetics.Tolerance;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public abstract class ControlToleranceBar<T extends Enum<T>> extends Control implements ITooltip {
|
||||
EnumSet<T> tolerated;
|
||||
EnumSet<T> fullSet;
|
||||
private Class<T> enumClass;
|
||||
EnumSet<T> tolerated;
|
||||
EnumSet<T> fullSet;
|
||||
private Class<T> enumClass;
|
||||
|
||||
public ControlToleranceBar(IWidget parent, float x, float y, float width, float height, Class<T> clss) {
|
||||
super(parent, x, y, width, height);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
enumClass = clss;
|
||||
tolerated = EnumSet.noneOf(enumClass);
|
||||
fullSet = EnumSet.allOf(enumClass);
|
||||
if (enumClass == EnumTemperature.class) {
|
||||
fullSet.remove(EnumTemperature.NONE);
|
||||
}
|
||||
}
|
||||
public ControlToleranceBar(IWidget parent, float x, float y, float width, float height, Class<T> clss) {
|
||||
super(parent, x, y, width, height);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
enumClass = clss;
|
||||
tolerated = EnumSet.noneOf(enumClass);
|
||||
fullSet = EnumSet.allOf(enumClass);
|
||||
if (enumClass == EnumTemperature.class) {
|
||||
fullSet.remove(EnumTemperature.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
int types = fullSet.size();
|
||||
int type = (int) ((int) getRelativeMousePosition().x() / (getSize().x() / types));
|
||||
for (T tol : fullSet) {
|
||||
if (tol.ordinal() - ((enumClass == EnumTemperature.class) ? 1 : 0) == type) {
|
||||
tooltip.add((tolerated.contains(tol) ? "" : EnumChatFormatting.DARK_GRAY) + getName(tol));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
int types = fullSet.size();
|
||||
int type = (int) ((int) getRelativeMousePosition().x() / (getSize().x() / types));
|
||||
for (T tol : fullSet) {
|
||||
if (tol.ordinal() - ((enumClass == EnumTemperature.class) ? 1 : 0) == type) {
|
||||
tooltip.add((tolerated.contains(tol) ? "" : EnumChatFormatting.DARK_GRAY) + getName(tol));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract String getName(T p0);
|
||||
protected abstract String getName(T p0);
|
||||
|
||||
protected abstract int getColor(T p0);
|
||||
protected abstract int getColor(T p0);
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.gradientRect(getArea(), 0xaaaaaaaa, 0xaaaaaaaa);
|
||||
float w = getArea().w() / fullSet.size();
|
||||
int t = 0;
|
||||
for (T value : fullSet) {
|
||||
int col = (tolerated.contains(value) ? 0xff000000 : 0x33000000) + getColor(value);
|
||||
IBorder inset = new IBorder(tolerated.contains(value) ? 1.0f : 3.0f);
|
||||
CraftGUI.render.gradientRect(new IArea(w * t, 0.0f, w, h()).inset(inset), col, col);
|
||||
++t;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.gradientRect(getArea(), 0xaaaaaaaa, 0xaaaaaaaa);
|
||||
float w = getArea().w() / fullSet.size();
|
||||
int t = 0;
|
||||
for (T value : fullSet) {
|
||||
int col = (tolerated.contains(value) ? 0xff000000 : 0x33000000) + getColor(value);
|
||||
IBorder inset = new IBorder(tolerated.contains(value) ? 1.0f : 3.0f);
|
||||
CraftGUI.render.gradientRect(new IArea(w * t, 0.0f, w, h()).inset(inset), col, col);
|
||||
++t;
|
||||
}
|
||||
}
|
||||
|
||||
public void setValues(T value, EnumTolerance enumTol) {
|
||||
tolerated.clear();
|
||||
Tolerance tol = Tolerance.get(enumTol);
|
||||
for (T full : fullSet) {
|
||||
if (full.ordinal() > value.ordinal() + tol.getBounds()[1]) {
|
||||
continue;
|
||||
}
|
||||
if (full.ordinal() < value.ordinal() + tol.getBounds()[0]) {
|
||||
continue;
|
||||
}
|
||||
tolerated.add(full);
|
||||
}
|
||||
}
|
||||
public void setValues(T value, EnumTolerance enumTol) {
|
||||
tolerated.clear();
|
||||
Tolerance tol = Tolerance.get(enumTol);
|
||||
for (T full : fullSet) {
|
||||
if (full.ordinal() > value.ordinal() + tol.getBounds()[1]) {
|
||||
continue;
|
||||
}
|
||||
if (full.ordinal() < value.ordinal() + tol.getBounds()[0]) {
|
||||
continue;
|
||||
}
|
||||
tolerated.add(full);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,12 @@ import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
|
||||
public class ControlTooltip extends Control implements ITooltip {
|
||||
public ControlTooltip(IWidget parent, float x, float y, float w, float h) {
|
||||
super(parent, x, y, w, h);
|
||||
}
|
||||
public ControlTooltip(IWidget parent, float x, float y, float w, float h) {
|
||||
super(parent, x, y, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
@@ -39,458 +39,498 @@ import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WindowAnalyst extends Window {
|
||||
protected IWidget baseWidget;
|
||||
protected ControlScrollableContent leftPage;
|
||||
protected ControlScrollableContent rightPage;
|
||||
protected Control tabBar;
|
||||
protected Panel analystPanel;
|
||||
protected List<ControlAnalystPage> analystPages;
|
||||
protected IArea analystPageSize;
|
||||
protected boolean isDatabase;
|
||||
protected boolean isMaster;
|
||||
protected boolean lockedSearch;
|
||||
protected IIndividual current;
|
||||
protected BreedingSystem currentSystem;
|
||||
protected IWidget baseWidget;
|
||||
protected ControlScrollableContent leftPage;
|
||||
protected ControlScrollableContent rightPage;
|
||||
protected Control tabBar;
|
||||
protected Panel analystPanel;
|
||||
protected List<ControlAnalystPage> analystPages;
|
||||
protected IArea analystPageSize;
|
||||
protected boolean isDatabase;
|
||||
protected boolean isMaster;
|
||||
protected boolean lockedSearch;
|
||||
protected IIndividual current;
|
||||
protected BreedingSystem currentSystem;
|
||||
|
||||
private Control analystNone;
|
||||
private ControlSlide slideUpInv;
|
||||
private Control analystNone;
|
||||
private ControlSlide slideUpInv;
|
||||
|
||||
public WindowAnalyst(EntityPlayer player, IInventory inventory, Side side, boolean database, boolean master) {
|
||||
super(312.0f, 230.0f, player, inventory, side);
|
||||
baseWidget = null;
|
||||
tabBar = null;
|
||||
analystPages = new ArrayList<>();
|
||||
analystPageSize = null;
|
||||
isDatabase = false;
|
||||
isMaster = false;
|
||||
lockedSearch = false;
|
||||
current = null;
|
||||
currentSystem = null;
|
||||
isDatabase = database;
|
||||
isMaster = master;
|
||||
lockedSearch = isDatabase;
|
||||
}
|
||||
public WindowAnalyst(EntityPlayer player, IInventory inventory, Side side, boolean database, boolean master) {
|
||||
super(312.0f, 230.0f, player, inventory, side);
|
||||
baseWidget = null;
|
||||
tabBar = null;
|
||||
analystPages = new ArrayList<>();
|
||||
analystPageSize = null;
|
||||
isDatabase = false;
|
||||
isMaster = false;
|
||||
lockedSearch = false;
|
||||
current = null;
|
||||
currentSystem = null;
|
||||
isDatabase = database;
|
||||
isMaster = master;
|
||||
lockedSearch = isDatabase;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Analyst";
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return "Analyst";
|
||||
}
|
||||
|
||||
private void setupValidators() {
|
||||
if (!isDatabase) {
|
||||
getWindowInventory().setValidator(0, new SlotValidator.Individual() {
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return Analyser.isAnalysed(itemStack) || (Analyser.isAnalysable(itemStack) && getWindowInventory().getStackInSlot(1) != null);
|
||||
}
|
||||
});
|
||||
getWindowInventory().setValidator(1, new SlotValidator.Item(GeneticsItems.DNADye.get(1), ModuleMachine.IconDye));
|
||||
}
|
||||
}
|
||||
private void setupValidators() {
|
||||
if (!isDatabase) {
|
||||
getWindowInventory().setValidator(0, new SlotValidator.Individual() {
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return Analyser.isAnalysed(itemStack)
|
||||
|| (Analyser.isAnalysable(itemStack)
|
||||
&& getWindowInventory().getStackInSlot(1) != null);
|
||||
}
|
||||
});
|
||||
getWindowInventory()
|
||||
.setValidator(1, new SlotValidator.Item(GeneticsItems.DNADye.get(1), ModuleMachine.IconDye));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseServer() {
|
||||
for (BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
|
||||
IBreedingTracker tracker = system.getSpeciesRoot().getBreedingTracker(getWorld(), getUsername());
|
||||
if (tracker != null) {
|
||||
tracker.synchToPlayer(getPlayer());
|
||||
}
|
||||
}
|
||||
setupValidators();
|
||||
}
|
||||
@Override
|
||||
public void initialiseServer() {
|
||||
for (BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
|
||||
IBreedingTracker tracker = system.getSpeciesRoot().getBreedingTracker(getWorld(), getUsername());
|
||||
if (tracker != null) {
|
||||
tracker.synchToPlayer(getPlayer());
|
||||
}
|
||||
}
|
||||
setupValidators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
if (isDatabase) {
|
||||
if (isMaster) {
|
||||
setTitle(I18N.localise("genetics.item.registry.1.name"));
|
||||
} else {
|
||||
setTitle(I18N.localise("genetics.item.registry.0.name"));
|
||||
}
|
||||
} else {
|
||||
setTitle(I18N.localise("genetics.item.analyst.name"));
|
||||
}
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
if (isDatabase) {
|
||||
if (isMaster) {
|
||||
setTitle(I18N.localise("genetics.item.registry.1.name"));
|
||||
} else {
|
||||
setTitle(I18N.localise("genetics.item.registry.0.name"));
|
||||
}
|
||||
} else {
|
||||
setTitle(I18N.localise("genetics.item.analyst.name"));
|
||||
}
|
||||
|
||||
getWindowInventory().createSlot(0);
|
||||
baseWidget = new Widget(this);
|
||||
int x = 16;
|
||||
int y = 28;
|
||||
getWindowInventory().createSlot(0);
|
||||
baseWidget = new Widget(this);
|
||||
int x = 16;
|
||||
int y = 28;
|
||||
|
||||
if (isDatabase) {
|
||||
for (BreedingSystem syst : Binnie.Genetics.getActiveSystems()) {
|
||||
new Control(this, x, y, 20.0f, 20.0f) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
setSystem(syst);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (isDatabase) {
|
||||
for (BreedingSystem syst : Binnie.Genetics.getActiveSystems()) {
|
||||
new Control(this, x, y, 20.0f, 20.0f) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
setSystem(syst);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(syst.getName());
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(syst.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.color(syst.getColor());
|
||||
int outset = (getSystem() == syst) ? 1 : 0;
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().outset(outset));
|
||||
if (getSystem() == syst) {
|
||||
CraftGUI.render.color(1140850688 + syst.getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(outset));
|
||||
}
|
||||
CraftGUI.render.item(new IPoint(2.0f, 2.0f), syst.getItemStackRepresentative());
|
||||
}
|
||||
};
|
||||
x += 22;
|
||||
}
|
||||
} else {
|
||||
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 0);
|
||||
x += 22;
|
||||
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 1);
|
||||
x += 26;
|
||||
setupValidators();
|
||||
}
|
||||
tabBar = new Control(this, x, 28.0f, w() - 16.0f - x, 20.0f);
|
||||
analystPanel = new Panel(this, 16.0f, 54.0f, 280.0f, 164.0f, MinecraftGUI.PanelType.Outline) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.gradientRect(getArea(), 0x44ffffff, 0x66ffffff);
|
||||
super.onRenderBackground();
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.color(syst.getColor());
|
||||
int outset = (getSystem() == syst) ? 1 : 0;
|
||||
CraftGUI.render.texture(
|
||||
CraftGUITexture.TabOutline, getArea().outset(outset));
|
||||
if (getSystem() == syst) {
|
||||
CraftGUI.render.color(1140850688 + syst.getColor());
|
||||
CraftGUI.render.texture(
|
||||
CraftGUITexture.TabSolid, getArea().outset(outset));
|
||||
}
|
||||
CraftGUI.render.item(new IPoint(2.0f, 2.0f), syst.getItemStackRepresentative());
|
||||
}
|
||||
};
|
||||
x += 22;
|
||||
}
|
||||
} else {
|
||||
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 0);
|
||||
x += 22;
|
||||
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 1);
|
||||
x += 26;
|
||||
setupValidators();
|
||||
}
|
||||
tabBar = new Control(this, x, 28.0f, w() - 16.0f - x, 20.0f);
|
||||
analystPanel = new Panel(this, 16.0f, 54.0f, 280.0f, 164.0f, MinecraftGUI.PanelType.Outline) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.render.gradientRect(getArea(), 0x44ffffff, 0x66ffffff);
|
||||
super.onRenderBackground();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialise() {
|
||||
setColor(0x444444);
|
||||
float sectionWidth = (w() - 8.0f - 4.0f) / 2.0f;
|
||||
leftPage = new ControlScrollableContent<IWidget>(this, 3.0f, 3.0f, sectionWidth + 2.0f, h() - 8.0f + 2.0f, 0.0f) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (getContent() == null) {
|
||||
return;
|
||||
}
|
||||
CraftGUI.render.color(getContent().getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
|
||||
}
|
||||
};
|
||||
new ControlScrollBar(this, sectionWidth + 2.0f - 3.0f, 6.0f, 3.0f, h() - 8.0f + 2.0f - 6.0f, leftPage) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (leftPage.getContent() == null) {
|
||||
return;
|
||||
}
|
||||
CraftGUI.render.gradientRect(getArea(), 1140850688 + leftPage.getContent().getColor(), 0x44000000 + leftPage.getContent().getColor());
|
||||
CraftGUI.render.solid(getRenderArea(), leftPage.getContent().getColor());
|
||||
}
|
||||
};
|
||||
rightPage = new ControlScrollableContent<IWidget>(this, 3.0f + sectionWidth + 4.0f, 3.0f, sectionWidth + 2.0f, h() - 8.0f + 2.0f, 0.0f) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (getContent() == null) {
|
||||
return;
|
||||
}
|
||||
CraftGUI.render.color(getContent().getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
|
||||
}
|
||||
};
|
||||
new ControlScrollBar(this, sectionWidth + 2.0f - 3.0f + sectionWidth + 4.0f, 6.0f, 3.0f, h() - 8.0f + 2.0f - 6.0f, rightPage) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (rightPage.getContent() == null) {
|
||||
return;
|
||||
}
|
||||
CraftGUI.render.gradientRect(getArea(), 1140850688 + rightPage.getContent().getColor(), 0x44000000 + rightPage.getContent().getColor());
|
||||
CraftGUI.render.solid(getRenderArea(), rightPage.getContent().getColor());
|
||||
}
|
||||
};
|
||||
analystPageSize = new IArea(1.0f, 1.0f, sectionWidth, h() - 8.0f);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public void initialise() {
|
||||
setColor(0x444444);
|
||||
float sectionWidth = (w() - 8.0f - 4.0f) / 2.0f;
|
||||
leftPage =
|
||||
new ControlScrollableContent<IWidget>(
|
||||
this, 3.0f, 3.0f, sectionWidth + 2.0f, h() - 8.0f + 2.0f, 0.0f) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (getContent() == null) {
|
||||
return;
|
||||
}
|
||||
CraftGUI.render.color(getContent().getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
|
||||
}
|
||||
};
|
||||
new ControlScrollBar(this, sectionWidth + 2.0f - 3.0f, 6.0f, 3.0f, h() - 8.0f + 2.0f - 6.0f, leftPage) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (leftPage.getContent() == null) {
|
||||
return;
|
||||
}
|
||||
CraftGUI.render.gradientRect(
|
||||
getArea(),
|
||||
1140850688 + leftPage.getContent().getColor(),
|
||||
0x44000000 + leftPage.getContent().getColor());
|
||||
CraftGUI.render.solid(
|
||||
getRenderArea(), leftPage.getContent().getColor());
|
||||
}
|
||||
};
|
||||
rightPage =
|
||||
new ControlScrollableContent<IWidget>(
|
||||
this, 3.0f + sectionWidth + 4.0f, 3.0f, sectionWidth + 2.0f, h() - 8.0f + 2.0f, 0.0f) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (getContent() == null) {
|
||||
return;
|
||||
}
|
||||
CraftGUI.render.color(getContent().getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
|
||||
}
|
||||
};
|
||||
new ControlScrollBar(
|
||||
this,
|
||||
sectionWidth + 2.0f - 3.0f + sectionWidth + 4.0f,
|
||||
6.0f,
|
||||
3.0f,
|
||||
h() - 8.0f + 2.0f - 6.0f,
|
||||
rightPage) {
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (rightPage.getContent() == null) {
|
||||
return;
|
||||
}
|
||||
CraftGUI.render.gradientRect(
|
||||
getArea(),
|
||||
1140850688 + rightPage.getContent().getColor(),
|
||||
0x44000000 + rightPage.getContent().getColor());
|
||||
CraftGUI.render.solid(
|
||||
getRenderArea(), rightPage.getContent().getColor());
|
||||
}
|
||||
};
|
||||
analystPageSize = new IArea(1.0f, 1.0f, sectionWidth, h() - 8.0f);
|
||||
}
|
||||
};
|
||||
|
||||
if (!isDatabase) {
|
||||
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);
|
||||
}
|
||||
addEventHandler(new EventKey.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventKey.Down event) {
|
||||
if (event.getKey() == 205) {
|
||||
shiftPages(true);
|
||||
}
|
||||
if (event.getKey() == 203) {
|
||||
shiftPages(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!isDatabase) {
|
||||
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);
|
||||
}
|
||||
addEventHandler(new EventKey.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventKey.Down event) {
|
||||
if (event.getKey() == 205) {
|
||||
shiftPages(true);
|
||||
}
|
||||
if (event.getKey() == 203) {
|
||||
shiftPages(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!isDatabase) {
|
||||
analystNone = new Control(analystPanel, 0.0f, 0.0f, analystPanel.w(), analystPanel.h()) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
new ControlTextCentered(this, 20.0f, I18N.localise("genetics.gui.analyst.info")).setColor(0x444444);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
setIndividual(null);
|
||||
setSystem(Binnie.Genetics.beeBreedingSystem);
|
||||
}
|
||||
if (!isDatabase) {
|
||||
analystNone = new Control(analystPanel, 0.0f, 0.0f, analystPanel.w(), analystPanel.h()) {
|
||||
@Override
|
||||
public void initialise() {
|
||||
new ControlTextCentered(this, 20.0f, I18N.localise("genetics.gui.analyst.info")).setColor(0x444444);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
setIndividual(null);
|
||||
setSystem(Binnie.Genetics.beeBreedingSystem);
|
||||
}
|
||||
|
||||
public void updatePages(boolean systemChange) {
|
||||
int oldLeft = -1;
|
||||
int oldRight = -1;
|
||||
if (!systemChange) {
|
||||
oldLeft = analystPages.indexOf(leftPage.getContent());
|
||||
oldRight = analystPages.indexOf(rightPage.getContent());
|
||||
}
|
||||
public void updatePages(boolean systemChange) {
|
||||
int oldLeft = -1;
|
||||
int oldRight = -1;
|
||||
if (!systemChange) {
|
||||
oldLeft = analystPages.indexOf(leftPage.getContent());
|
||||
oldRight = analystPages.indexOf(rightPage.getContent());
|
||||
}
|
||||
|
||||
ControlAnalystPage databasePage = null;
|
||||
if (isDatabase && !systemChange) {
|
||||
databasePage = ((analystPages.size() > 0) ? analystPages.get(0) : null);
|
||||
}
|
||||
ControlAnalystPage databasePage = null;
|
||||
if (isDatabase && !systemChange) {
|
||||
databasePage = ((analystPages.size() > 0) ? analystPages.get(0) : null);
|
||||
}
|
||||
|
||||
analystPages.clear();
|
||||
setPage(leftPage, null);
|
||||
setPage(rightPage, null);
|
||||
if (isDatabase) {
|
||||
analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(analystPanel, analystPageSize, currentSystem, isMaster));
|
||||
}
|
||||
analystPages.clear();
|
||||
setPage(leftPage, null);
|
||||
setPage(rightPage, null);
|
||||
if (isDatabase) {
|
||||
analystPages.add(
|
||||
(databasePage != null)
|
||||
? databasePage
|
||||
: new AnalystPageDatabase(analystPanel, analystPageSize, currentSystem, isMaster));
|
||||
}
|
||||
|
||||
if (current != null) {
|
||||
analystPages.add(new AnalystPageDescription(analystPanel, analystPageSize, current));
|
||||
analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, true, current));
|
||||
if (!isDatabase) {
|
||||
analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, false, current));
|
||||
analystPages.add(new AnalystPageKaryogram(analystPanel, analystPageSize, current));
|
||||
}
|
||||
if (current != null) {
|
||||
analystPages.add(new AnalystPageDescription(analystPanel, analystPageSize, current));
|
||||
analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, true, current));
|
||||
if (!isDatabase) {
|
||||
analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, false, current));
|
||||
analystPages.add(new AnalystPageKaryogram(analystPanel, analystPageSize, current));
|
||||
}
|
||||
|
||||
if (!(current instanceof ITree)) {
|
||||
analystPages.add(new AnalystPageClimate(analystPanel, analystPageSize, current));
|
||||
}
|
||||
if (!(current instanceof ITree)) {
|
||||
analystPages.add(new AnalystPageClimate(analystPanel, analystPageSize, current));
|
||||
}
|
||||
|
||||
if (current instanceof IBee) {
|
||||
analystPages.add(new AnalystPageProducts(analystPanel, analystPageSize, (IBee) current));
|
||||
} else if (current instanceof ITree) {
|
||||
analystPages.add(new AnalystPageFruit(analystPanel, analystPageSize, (ITree) current));
|
||||
analystPages.add(new AnalystPageWood(analystPanel, analystPageSize, (ITree) current));
|
||||
} else if (current instanceof IFlower) {
|
||||
analystPages.add(new AnalystPageSoil(analystPanel, analystPageSize, (IFlower) current));
|
||||
} else if (current instanceof IButterfly) {
|
||||
analystPages.add(new AnalystPageSpecimen(analystPanel, analystPageSize, (IButterfly) current));
|
||||
}
|
||||
if (current instanceof IBee) {
|
||||
analystPages.add(new AnalystPageProducts(analystPanel, analystPageSize, (IBee) current));
|
||||
} else if (current instanceof ITree) {
|
||||
analystPages.add(new AnalystPageFruit(analystPanel, analystPageSize, (ITree) current));
|
||||
analystPages.add(new AnalystPageWood(analystPanel, analystPageSize, (ITree) current));
|
||||
} else if (current instanceof IFlower) {
|
||||
analystPages.add(new AnalystPageSoil(analystPanel, analystPageSize, (IFlower) current));
|
||||
} else if (current instanceof IButterfly) {
|
||||
analystPages.add(new AnalystPageSpecimen(analystPanel, analystPageSize, (IButterfly) current));
|
||||
}
|
||||
|
||||
analystPages.add(new AnalystPageBiology(analystPanel, analystPageSize, current));
|
||||
if (current instanceof IBee || current instanceof IButterfly) {
|
||||
analystPages.add(new AnalystPageBehaviour(analystPanel, analystPageSize, current));
|
||||
} else if (current instanceof ITree) {
|
||||
analystPages.add(new AnalystPageGrowth(analystPanel, analystPageSize, current));
|
||||
} else if (current instanceof IFlower) {
|
||||
analystPages.add(new AnalystPageAppearance(analystPanel, analystPageSize, (IFlower) current));
|
||||
}
|
||||
analystPages.add(new AnalystPageMutations(analystPanel, analystPageSize, current, isMaster));
|
||||
}
|
||||
analystPages.add(new AnalystPageBiology(analystPanel, analystPageSize, current));
|
||||
if (current instanceof IBee || current instanceof IButterfly) {
|
||||
analystPages.add(new AnalystPageBehaviour(analystPanel, analystPageSize, current));
|
||||
} else if (current instanceof ITree) {
|
||||
analystPages.add(new AnalystPageGrowth(analystPanel, analystPageSize, current));
|
||||
} else if (current instanceof IFlower) {
|
||||
analystPages.add(new AnalystPageAppearance(analystPanel, analystPageSize, (IFlower) current));
|
||||
}
|
||||
analystPages.add(new AnalystPageMutations(analystPanel, analystPageSize, current, isMaster));
|
||||
}
|
||||
|
||||
tabBar.deleteAllChildren();
|
||||
float width = tabBar.w() / analystPages.size();
|
||||
float x = 0.0f;
|
||||
tabBar.deleteAllChildren();
|
||||
float width = tabBar.w() / analystPages.size();
|
||||
float x = 0.0f;
|
||||
|
||||
for (ControlAnalystPage page : analystPages) {
|
||||
new ControlTooltip(tabBar, x, 0.0f, width, tabBar.h()) {
|
||||
ControlAnalystPage value;
|
||||
for (ControlAnalystPage page : analystPages) {
|
||||
new ControlTooltip(tabBar, x, 0.0f, width, tabBar.h()) {
|
||||
ControlAnalystPage value;
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(value.getTitle());
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
tooltip.add(value.getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialise() {
|
||||
super.initialise();
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
value = page;
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
int currentIndex = analystPages.indexOf(rightPage.getContent());
|
||||
int clickedIndex = analystPages.indexOf(value);
|
||||
if (isDatabase) {
|
||||
if (clickedIndex != 0 && clickedIndex != currentIndex) {
|
||||
setPage(rightPage, value);
|
||||
}
|
||||
} else {
|
||||
if (clickedIndex < 0) {
|
||||
clickedIndex = 0;
|
||||
}
|
||||
if (clickedIndex < currentIndex) {
|
||||
++clickedIndex;
|
||||
}
|
||||
setPage(rightPage, null);
|
||||
setPage(leftPage, null);
|
||||
setPage(rightPage, analystPages.get(clickedIndex));
|
||||
setPage(leftPage, analystPages.get(clickedIndex - 1));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void initialise() {
|
||||
super.initialise();
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
value = page;
|
||||
addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(EventMouse.Down event) {
|
||||
int currentIndex = analystPages.indexOf(rightPage.getContent());
|
||||
int clickedIndex = analystPages.indexOf(value);
|
||||
if (isDatabase) {
|
||||
if (clickedIndex != 0 && clickedIndex != currentIndex) {
|
||||
setPage(rightPage, value);
|
||||
}
|
||||
} else {
|
||||
if (clickedIndex < 0) {
|
||||
clickedIndex = 0;
|
||||
}
|
||||
if (clickedIndex < currentIndex) {
|
||||
++clickedIndex;
|
||||
}
|
||||
setPage(rightPage, null);
|
||||
setPage(leftPage, null);
|
||||
setPage(rightPage, analystPages.get(clickedIndex));
|
||||
setPage(leftPage, analystPages.get(clickedIndex - 1));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
boolean active = value == leftPage.getContent() || value == rightPage.getContent();
|
||||
CraftGUI.render.color((active ? 0xff000000 : 0x44000000) + value.getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
|
||||
CraftGUI.render.color(value.getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().inset(1));
|
||||
super.onRenderBackground();
|
||||
}
|
||||
};
|
||||
x += width;
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
boolean active = value == leftPage.getContent() || value == rightPage.getContent();
|
||||
CraftGUI.render.color((active ? 0xff000000 : 0x44000000) + value.getColor());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
|
||||
CraftGUI.render.color(value.getColor());
|
||||
CraftGUI.render.texture(
|
||||
CraftGUITexture.TabOutline, getArea().inset(1));
|
||||
super.onRenderBackground();
|
||||
}
|
||||
};
|
||||
x += width;
|
||||
}
|
||||
|
||||
if (analystPages.size() > 0) {
|
||||
setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0));
|
||||
}
|
||||
if (analystPages.size() > 1) {
|
||||
setPage(rightPage, analystPages.get((oldRight >= 0) ? oldRight : 1));
|
||||
}
|
||||
}
|
||||
if (analystPages.size() > 0) {
|
||||
setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0));
|
||||
}
|
||||
if (analystPages.size() > 1) {
|
||||
setPage(rightPage, analystPages.get((oldRight >= 0) ? oldRight : 1));
|
||||
}
|
||||
}
|
||||
|
||||
public void shiftPages(boolean right) {
|
||||
if (analystPages.size() < 2) {
|
||||
return;
|
||||
}
|
||||
int leftIndex = analystPages.indexOf(leftPage.getContent());
|
||||
int rightIndex = analystPages.indexOf(rightPage.getContent());
|
||||
if (right && rightIndex + 1 >= analystPages.size()) {
|
||||
return;
|
||||
}
|
||||
if (!lockedSearch && !right && leftIndex <= 0) {
|
||||
return;
|
||||
}
|
||||
if (!lockedSearch && !right && rightIndex <= 1) {
|
||||
return;
|
||||
}
|
||||
int newRightIndex = rightIndex + (right ? 1 : -1);
|
||||
int newLeftIndex = lockedSearch ? 0 : (newRightIndex - 1);
|
||||
float oldRightPercent = 0.0f;
|
||||
float oldLeftPercent = 0.0f;
|
||||
if (newLeftIndex == rightIndex) {
|
||||
oldRightPercent = rightPage.getPercentageIndex();
|
||||
}
|
||||
if (newRightIndex == leftIndex) {
|
||||
oldLeftPercent = leftPage.getPercentageIndex();
|
||||
}
|
||||
setPage(leftPage, null);
|
||||
setPage(rightPage, null);
|
||||
setPage(leftPage, analystPages.get(newLeftIndex));
|
||||
setPage(rightPage, analystPages.get(newRightIndex));
|
||||
analystPages.get(newLeftIndex).show();
|
||||
if (oldRightPercent != 0.0f) {
|
||||
leftPage.setPercentageIndex(oldRightPercent);
|
||||
}
|
||||
if (oldLeftPercent != 0.0f) {
|
||||
rightPage.setPercentageIndex(oldLeftPercent);
|
||||
}
|
||||
}
|
||||
public void shiftPages(boolean right) {
|
||||
if (analystPages.size() < 2) {
|
||||
return;
|
||||
}
|
||||
int leftIndex = analystPages.indexOf(leftPage.getContent());
|
||||
int rightIndex = analystPages.indexOf(rightPage.getContent());
|
||||
if (right && rightIndex + 1 >= analystPages.size()) {
|
||||
return;
|
||||
}
|
||||
if (!lockedSearch && !right && leftIndex <= 0) {
|
||||
return;
|
||||
}
|
||||
if (!lockedSearch && !right && rightIndex <= 1) {
|
||||
return;
|
||||
}
|
||||
int newRightIndex = rightIndex + (right ? 1 : -1);
|
||||
int newLeftIndex = lockedSearch ? 0 : (newRightIndex - 1);
|
||||
float oldRightPercent = 0.0f;
|
||||
float oldLeftPercent = 0.0f;
|
||||
if (newLeftIndex == rightIndex) {
|
||||
oldRightPercent = rightPage.getPercentageIndex();
|
||||
}
|
||||
if (newRightIndex == leftIndex) {
|
||||
oldLeftPercent = leftPage.getPercentageIndex();
|
||||
}
|
||||
setPage(leftPage, null);
|
||||
setPage(rightPage, null);
|
||||
setPage(leftPage, analystPages.get(newLeftIndex));
|
||||
setPage(rightPage, analystPages.get(newRightIndex));
|
||||
analystPages.get(newLeftIndex).show();
|
||||
if (oldRightPercent != 0.0f) {
|
||||
leftPage.setPercentageIndex(oldRightPercent);
|
||||
}
|
||||
if (oldLeftPercent != 0.0f) {
|
||||
rightPage.setPercentageIndex(oldLeftPercent);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPage(ControlScrollableContent side, ControlAnalystPage page) {
|
||||
ControlAnalystPage existingPage = (ControlAnalystPage) side.getContent();
|
||||
if (existingPage != null) {
|
||||
existingPage.hide();
|
||||
side.setScrollableContent(null);
|
||||
}
|
||||
if (page != null) {
|
||||
page.show();
|
||||
side.setScrollableContent(page);
|
||||
side.setPercentageIndex(0.0f);
|
||||
page.setPosition(side.pos().add(1.0f, 1.0f));
|
||||
}
|
||||
}
|
||||
public void setPage(ControlScrollableContent side, ControlAnalystPage page) {
|
||||
ControlAnalystPage existingPage = (ControlAnalystPage) side.getContent();
|
||||
if (existingPage != null) {
|
||||
existingPage.hide();
|
||||
side.setScrollableContent(null);
|
||||
}
|
||||
if (page != null) {
|
||||
page.show();
|
||||
side.setScrollableContent(page);
|
||||
side.setPercentageIndex(0.0f);
|
||||
page.setPosition(side.pos().add(1.0f, 1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowInventoryChanged() {
|
||||
super.onWindowInventoryChanged();
|
||||
if (getWindowInventory().getStackInSlot(0) != null && !Analyser.isAnalysed(getWindowInventory().getStackInSlot(0))) {
|
||||
getWindowInventory().setInventorySlotContents(0, Analyser.analyse(getWindowInventory().getStackInSlot(0)));
|
||||
getWindowInventory().decrStackSize(1, 1);
|
||||
}
|
||||
@Override
|
||||
public void onWindowInventoryChanged() {
|
||||
super.onWindowInventoryChanged();
|
||||
if (getWindowInventory().getStackInSlot(0) != null
|
||||
&& !Analyser.isAnalysed(getWindowInventory().getStackInSlot(0))) {
|
||||
getWindowInventory()
|
||||
.setInventorySlotContents(
|
||||
0, Analyser.analyse(getWindowInventory().getStackInSlot(0)));
|
||||
getWindowInventory().decrStackSize(1, 1);
|
||||
}
|
||||
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(getWindowInventory().getStackInSlot(0));
|
||||
if (ind != null) {
|
||||
ind.getGenome().getSpeciesRoot().getBreedingTracker(getWorld(), getUsername()).registerBirth(ind);
|
||||
}
|
||||
IIndividual ind =
|
||||
AlleleManager.alleleRegistry.getIndividual(getWindowInventory().getStackInSlot(0));
|
||||
if (ind != null) {
|
||||
ind.getGenome()
|
||||
.getSpeciesRoot()
|
||||
.getBreedingTracker(getWorld(), getUsername())
|
||||
.registerBirth(ind);
|
||||
}
|
||||
|
||||
if (isClient()) {
|
||||
setStack(getWindowInventory().getStackInSlot(0));
|
||||
}
|
||||
}
|
||||
if (isClient()) {
|
||||
setStack(getWindowInventory().getStackInSlot(0));
|
||||
}
|
||||
}
|
||||
|
||||
public void setStack(ItemStack stack) {
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
setIndividual(ind);
|
||||
}
|
||||
public void setStack(ItemStack stack) {
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
setIndividual(ind);
|
||||
}
|
||||
|
||||
public IIndividual getIndividual() {
|
||||
return current;
|
||||
}
|
||||
public IIndividual getIndividual() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public void setIndividual(IIndividual ind) {
|
||||
if (!isDatabase) {
|
||||
if (ind == null) {
|
||||
analystNone.show();
|
||||
slideUpInv.hide();
|
||||
} else {
|
||||
analystNone.hide();
|
||||
slideUpInv.show();
|
||||
}
|
||||
}
|
||||
public void setIndividual(IIndividual ind) {
|
||||
if (!isDatabase) {
|
||||
if (ind == null) {
|
||||
analystNone.show();
|
||||
slideUpInv.hide();
|
||||
} else {
|
||||
analystNone.hide();
|
||||
slideUpInv.show();
|
||||
}
|
||||
}
|
||||
|
||||
if (ind == current || (ind != null && current != null && ind.isGeneticEqual(current))) {
|
||||
return;
|
||||
}
|
||||
if (ind == current || (ind != null && current != null && ind.isGeneticEqual(current))) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean systemChange = (current = ind) != null && ind.getGenome().getSpeciesRoot() != getSystem().getSpeciesRoot();
|
||||
if (systemChange) {
|
||||
currentSystem = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
|
||||
}
|
||||
updatePages(systemChange);
|
||||
}
|
||||
boolean systemChange = (current = ind) != null
|
||||
&& ind.getGenome().getSpeciesRoot() != getSystem().getSpeciesRoot();
|
||||
if (systemChange) {
|
||||
currentSystem = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
|
||||
}
|
||||
updatePages(systemChange);
|
||||
}
|
||||
|
||||
public BreedingSystem getSystem() {
|
||||
return currentSystem;
|
||||
}
|
||||
public BreedingSystem getSystem() {
|
||||
return currentSystem;
|
||||
}
|
||||
|
||||
public void setSystem(BreedingSystem system) {
|
||||
if (system == currentSystem) {
|
||||
return;
|
||||
}
|
||||
public void setSystem(BreedingSystem system) {
|
||||
if (system == currentSystem) {
|
||||
return;
|
||||
}
|
||||
|
||||
currentSystem = system;
|
||||
current = null;
|
||||
updatePages(true);
|
||||
}
|
||||
currentSystem = system;
|
||||
current = null;
|
||||
updatePages(true);
|
||||
}
|
||||
}
|
||||
@@ -10,78 +10,77 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public enum GeneticLiquid implements IFluidType {
|
||||
GrowthMedium("growthMedium", 0xebe8b5),
|
||||
Bacteria("bacteria", 0xd8ba81),
|
||||
BacteriaPoly("bacteriaPoly", 0xae9cc4),
|
||||
RawDNA("dna.raw", 0xe63de9),
|
||||
BacteriaVector("bacteriaVector", 0xf38b7e);
|
||||
GrowthMedium("growthMedium", 0xebe8b5),
|
||||
Bacteria("bacteria", 0xd8ba81),
|
||||
BacteriaPoly("bacteriaPoly", 0xae9cc4),
|
||||
RawDNA("dna.raw", 0xe63de9),
|
||||
BacteriaVector("bacteriaVector", 0xf38b7e);
|
||||
|
||||
protected String name;
|
||||
protected String ident;
|
||||
protected IIcon icon;
|
||||
protected int color;
|
||||
protected float transparency;
|
||||
protected String name;
|
||||
protected String ident;
|
||||
protected IIcon icon;
|
||||
protected int color;
|
||||
protected float transparency;
|
||||
|
||||
GeneticLiquid(String name, int color) {
|
||||
this.name = name;
|
||||
this.ident = name;
|
||||
this.color = color;
|
||||
transparency = 1.0f;
|
||||
}
|
||||
GeneticLiquid(String name, int color) {
|
||||
this.name = name;
|
||||
this.ident = name;
|
||||
this.color = color;
|
||||
transparency = 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcon(IIconRegister register) {
|
||||
icon = Genetics.proxy.getIcon(register, "liquids/" + ident);
|
||||
}
|
||||
@Override
|
||||
public void registerIcon(IIconRegister register) {
|
||||
icon = Genetics.proxy.getIcon(register, "liquids/" + ident);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("fluid.binnie." + name);
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("fluid.binnie." + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "binnie." + ident;
|
||||
}
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "binnie." + ident;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0xffffff;
|
||||
}
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContainerColor() {
|
||||
return color;
|
||||
}
|
||||
@Override
|
||||
public int getContainerColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack get(int amount) {
|
||||
return Binnie.Liquid.getLiquidStack(getIdentifier(), amount);
|
||||
}
|
||||
@Override
|
||||
public FluidStack get(int amount) {
|
||||
return Binnie.Liquid.getLiquidStack(getIdentifier(), amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getTransparency() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceIn(FluidContainer container) {
|
||||
return this == GeneticLiquid.GrowthMedium
|
||||
|| container == FluidContainer.Cylinder;
|
||||
}
|
||||
@Override
|
||||
public boolean canPlaceIn(FluidContainer container) {
|
||||
return this == GeneticLiquid.GrowthMedium || container == FluidContainer.Cylinder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInCreative(FluidContainer container) {
|
||||
return container == FluidContainer.Cylinder;
|
||||
}
|
||||
@Override
|
||||
public boolean showInCreative(FluidContainer container) {
|
||||
return container == FluidContainer.Cylinder;
|
||||
}
|
||||
}
|
||||
@@ -3,65 +3,64 @@ package binnie.genetics.item;
|
||||
import binnie.core.item.IItemMisc;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.genetics.Genetics;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public enum GeneticsItems implements IItemMisc {
|
||||
LaboratoryCasing("casingIron"),
|
||||
DNADye("dnaDye"),
|
||||
FluorescentDye("dyeFluor"),
|
||||
Enzyme("enzyme"),
|
||||
GrowthMedium("growthMedium"),
|
||||
EmptySequencer("sequencerEmpty"),
|
||||
EmptySerum("serumEmpty"),
|
||||
EmptyGenome("genomeEmpty"),
|
||||
Cylinder("cylinderEmpty"),
|
||||
IntegratedCircuit("integratedCircuit"),
|
||||
IntegratedCPU("integratedCPU"),
|
||||
IntegratedCasing("casingCircuit");
|
||||
LaboratoryCasing("casingIron"),
|
||||
DNADye("dnaDye"),
|
||||
FluorescentDye("dyeFluor"),
|
||||
Enzyme("enzyme"),
|
||||
GrowthMedium("growthMedium"),
|
||||
EmptySequencer("sequencerEmpty"),
|
||||
EmptySerum("serumEmpty"),
|
||||
EmptyGenome("genomeEmpty"),
|
||||
Cylinder("cylinderEmpty"),
|
||||
IntegratedCircuit("integratedCircuit"),
|
||||
IntegratedCPU("integratedCPU"),
|
||||
IntegratedCasing("casingCircuit");
|
||||
|
||||
protected IIcon icon;
|
||||
protected String name;
|
||||
protected String iconPath;
|
||||
protected IIcon icon;
|
||||
protected String name;
|
||||
protected String iconPath;
|
||||
|
||||
GeneticsItems(String name) {
|
||||
this.name = name;
|
||||
this.iconPath = name;
|
||||
}
|
||||
GeneticsItems(String name) {
|
||||
this.name = name;
|
||||
this.iconPath = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack itemStack) {
|
||||
return icon;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack itemStack) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icon = Genetics.proxy.getIcon(register, iconPath);
|
||||
}
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icon = Genetics.proxy.getIcon(register, iconPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(List data) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void addInformation(List data) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(ItemStack itemStack) {
|
||||
return I18N.localise("genetics.item." + name + ".name");
|
||||
}
|
||||
@Override
|
||||
public String getName(ItemStack itemStack) {
|
||||
return I18N.localise("genetics.item." + name + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack get(int count) {
|
||||
if (Genetics.itemGenetics == null) {
|
||||
return null;
|
||||
}
|
||||
return new ItemStack(Genetics.itemGenetics, count, ordinal());
|
||||
}
|
||||
@Override
|
||||
public ItemStack get(int count) {
|
||||
if (Genetics.itemGenetics == null) {
|
||||
return null;
|
||||
}
|
||||
return new ItemStack(Genetics.itemGenetics, count, ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -13,26 +13,26 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemAnalyst extends Item {
|
||||
public ItemAnalyst() {
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
setUnlocalizedName("analyst");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
public ItemAnalyst() {
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
setUnlocalizedName("analyst");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Genetics.proxy.getIcon(register, "analyst");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Genetics.proxy.getIcon(register, "analyst");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
Genetics.proxy.openGui(GeneticsGUI.Analyst, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
Genetics.proxy.openGui(GeneticsGUI.Analyst, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("genetics.item.analyst.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("genetics.item.analyst.name");
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import binnie.genetics.GeneticsCreativeTab;
|
||||
import binnie.genetics.core.GeneticsGUI;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -14,57 +15,57 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDatabase extends Item {
|
||||
protected IIcon iconMaster;
|
||||
protected IIcon iconMaster;
|
||||
|
||||
public ItemDatabase() {
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
setUnlocalizedName("database");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
public ItemDatabase() {
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
setUnlocalizedName("database");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Genetics.proxy.getIcon(register, "geneDatabase");
|
||||
iconMaster = Genetics.proxy.getIcon(register, "masterGeneDatabase");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Genetics.proxy.getIcon(register, "geneDatabase");
|
||||
iconMaster = Genetics.proxy.getIcon(register, "masterGeneDatabase");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
return (damage == 0) ? itemIcon : iconMaster;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
return (damage == 0) ? itemIcon : iconMaster;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
super.getSubItems(item, tab, list);
|
||||
list.add(new ItemStack(item, 1, 1));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
super.getSubItems(item, tab, list);
|
||||
list.add(new ItemStack(item, 1, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (stack.getItemDamage() == 0) {
|
||||
Genetics.proxy.openGui(GeneticsGUI.Database, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
} else {
|
||||
Genetics.proxy.openGui(GeneticsGUI.DatabaseNEI, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (stack.getItemDamage() == 0) {
|
||||
Genetics.proxy.openGui(
|
||||
GeneticsGUI.Database, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
} else {
|
||||
Genetics.proxy.openGui(
|
||||
GeneticsGUI.DatabaseNEI, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return (stack.getItemDamage() == 0) ?
|
||||
I18N.localise("genetics.item.database.0.name") :
|
||||
I18N.localise("genetics.item.database.1.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return (stack.getItemDamage() == 0)
|
||||
? I18N.localise("genetics.item.database.0.name")
|
||||
: I18N.localise("genetics.item.database.1.name");
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import binnie.core.util.I18N;
|
||||
import binnie.genetics.GeneticsCreativeTab;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -14,72 +15,71 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemFieldKit extends Item {
|
||||
private IIcon fieldKit0;
|
||||
private IIcon fieldKit1;
|
||||
private IIcon fieldKit2;
|
||||
private IIcon fieldKit3;
|
||||
private IIcon fieldKit0;
|
||||
private IIcon fieldKit1;
|
||||
private IIcon fieldKit2;
|
||||
private IIcon fieldKit3;
|
||||
|
||||
public ItemFieldKit() {
|
||||
setUnlocalizedName("fieldKit");
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(64);
|
||||
}
|
||||
public ItemFieldKit() {
|
||||
setUnlocalizedName("fieldKit");
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(64);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
fieldKit0 = Botany.proxy.getIcon(register, "fieldKit");
|
||||
fieldKit1 = Botany.proxy.getIcon(register, "fieldKit1");
|
||||
fieldKit2 = Botany.proxy.getIcon(register, "fieldKit2");
|
||||
fieldKit3 = Botany.proxy.getIcon(register, "fieldKit3");
|
||||
itemIcon = fieldKit0;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
fieldKit0 = Botany.proxy.getIcon(register, "fieldKit");
|
||||
fieldKit1 = Botany.proxy.getIcon(register, "fieldKit1");
|
||||
fieldKit2 = Botany.proxy.getIcon(register, "fieldKit2");
|
||||
fieldKit3 = Botany.proxy.getIcon(register, "fieldKit3");
|
||||
itemIcon = fieldKit0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
int damage = stack.getItemDamage();
|
||||
if (damage < 24) {
|
||||
return fieldKit3;
|
||||
}
|
||||
if (damage < 48) {
|
||||
return fieldKit2;
|
||||
}
|
||||
if (damage < 64) {
|
||||
return fieldKit1;
|
||||
}
|
||||
return fieldKit0;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
int damage = stack.getItemDamage();
|
||||
if (damage < 24) {
|
||||
return fieldKit3;
|
||||
}
|
||||
if (damage < 48) {
|
||||
return fieldKit2;
|
||||
}
|
||||
if (damage < 64) {
|
||||
return fieldKit1;
|
||||
}
|
||||
return fieldKit0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
if (!player.isSneaking()) {
|
||||
BinnieCore.proxy.openGui(BinnieCoreGUI.FieldKit, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
if (!player.isSneaking()) {
|
||||
BinnieCore.proxy.openGui(
|
||||
BinnieCoreGUI.FieldKit, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
int i = getMaxDamage() - itemStack.getItemDamage();
|
||||
if (i == 0) {
|
||||
tooltip.add(I18N.localise("genetics.item.fieldKit.tooltip.noPaper"));
|
||||
} else {
|
||||
if (i > 1) {
|
||||
tooltip.add(I18N.localise("genetics.item.fieldKit.tooltip.sheetsOfPaper", i));
|
||||
} else {
|
||||
tooltip.add(I18N.localise("genetics.item.fieldKit.tooltip.sheetOfPaper", i));
|
||||
}
|
||||
}
|
||||
super.addInformation(itemStack, player, tooltip, advanced);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
int i = getMaxDamage() - itemStack.getItemDamage();
|
||||
if (i == 0) {
|
||||
tooltip.add(I18N.localise("genetics.item.fieldKit.tooltip.noPaper"));
|
||||
} else {
|
||||
if (i > 1) {
|
||||
tooltip.add(I18N.localise("genetics.item.fieldKit.tooltip.sheetsOfPaper", i));
|
||||
} else {
|
||||
tooltip.add(I18N.localise("genetics.item.fieldKit.tooltip.sheetOfPaper", i));
|
||||
}
|
||||
}
|
||||
super.addInformation(itemStack, player, tooltip, advanced);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("genetics.item.fieldKit.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("genetics.item.fieldKit.name");
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import binnie.genetics.GeneticsCreativeTab;
|
||||
import binnie.genetics.genetics.IGeneItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -13,91 +14,89 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ItemGene extends Item {
|
||||
protected IIcon[] icons;
|
||||
protected IIcon[] icons;
|
||||
|
||||
public ItemGene(String unlocName) {
|
||||
icons = new IIcon[4];
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(16);
|
||||
setUnlocalizedName(unlocName);
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
}
|
||||
public ItemGene(String unlocName) {
|
||||
icons = new IIcon[4];
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(16);
|
||||
setUnlocalizedName(unlocName);
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass(int damage, int pass) {
|
||||
return icons[pass];
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass(int damage, int pass) {
|
||||
return icons[pass];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icons[0] = Genetics.proxy.getIcon(register, "machines/serum.glass");
|
||||
icons[1] = Genetics.proxy.getIcon(register, "machines/serum.cap");
|
||||
icons[2] = Genetics.proxy.getIcon(register, "machines/serum.edges");
|
||||
icons[3] = Genetics.proxy.getIcon(register, "machines/serum.dna");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icons[0] = Genetics.proxy.getIcon(register, "machines/serum.glass");
|
||||
icons[1] = Genetics.proxy.getIcon(register, "machines/serum.cap");
|
||||
icons[2] = Genetics.proxy.getIcon(register, "machines/serum.edges");
|
||||
icons[3] = Genetics.proxy.getIcon(register, "machines/serum.dna");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) {
|
||||
return 4;
|
||||
}
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemstack, int j) {
|
||||
IGeneItem gene = getGeneItem(itemstack);
|
||||
return gene.getColour(j);
|
||||
}
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemstack, int j) {
|
||||
IGeneItem gene = getGeneItem(itemstack);
|
||||
return gene.getColour(j);
|
||||
}
|
||||
|
||||
public int getCharges(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return 0;
|
||||
}
|
||||
return stack.getItem().getMaxDamage() - stack.getItemDamage();
|
||||
}
|
||||
public int getCharges(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return 0;
|
||||
}
|
||||
return stack.getItem().getMaxDamage() - stack.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
int damage = getMaxDamage() - stack.getItemDamage();
|
||||
if (damage == 0) {
|
||||
tooltip.add(I18N.localise("genetics.gene.charge.empty"));
|
||||
} else if (damage == 1) {
|
||||
tooltip.add(I18N.localise("genetics.gene.charge.one"));
|
||||
} else {
|
||||
tooltip.add(I18N.localise("genetics.gene.charge.many", damage));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
int damage = getMaxDamage() - stack.getItemDamage();
|
||||
if (damage == 0) {
|
||||
tooltip.add(I18N.localise("genetics.gene.charge.empty"));
|
||||
} else if (damage == 1) {
|
||||
tooltip.add(I18N.localise("genetics.gene.charge.one"));
|
||||
} else {
|
||||
tooltip.add(I18N.localise("genetics.gene.charge.many", damage));
|
||||
}
|
||||
|
||||
IGeneItem gene = getGeneItem(stack);
|
||||
gene.getInfo(tooltip);
|
||||
}
|
||||
IGeneItem gene = getGeneItem(stack);
|
||||
gene.getInfo(tooltip);
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract String getItemStackDisplayName(ItemStack stack);
|
||||
@Override
|
||||
public abstract String getItemStackDisplayName(ItemStack stack);
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List itemList) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List itemList) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract IGeneItem getGeneItem(ItemStack stack);
|
||||
public abstract IGeneItem getGeneItem(ItemStack stack);
|
||||
}
|
||||
@@ -13,26 +13,27 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemMasterRegistry extends Item {
|
||||
public ItemMasterRegistry() {
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
setUnlocalizedName("masterRegistry");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
public ItemMasterRegistry() {
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
setUnlocalizedName("masterRegistry");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Genetics.proxy.getIcon(register, "masterRegistry");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Genetics.proxy.getIcon(register, "masterRegistry");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
Genetics.proxy.openGui(GeneticsGUI.MasterRegistry, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
Genetics.proxy.openGui(
|
||||
GeneticsGUI.MasterRegistry, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("genetics.item.registry.1.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("genetics.item.registry.1.name");
|
||||
}
|
||||
}
|
||||
@@ -13,26 +13,26 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemRegistry extends Item {
|
||||
public ItemRegistry() {
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
setUnlocalizedName("registry");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
public ItemRegistry() {
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
setUnlocalizedName("registry");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Genetics.proxy.getIcon(register, "registry");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Genetics.proxy.getIcon(register, "registry");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
Genetics.proxy.openGui(GeneticsGUI.Registry, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
Genetics.proxy.openGui(GeneticsGUI.Registry, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack i) {
|
||||
return I18N.localise("genetics.item.registry.0.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack i) {
|
||||
return I18N.localise("genetics.item.registry.0.name");
|
||||
}
|
||||
}
|
||||
@@ -15,102 +15,103 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemSequence extends Item implements IItemAnalysable, IItemChargable {
|
||||
public ItemSequence() {
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(5);
|
||||
setUnlocalizedName("sequence");
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
}
|
||||
public ItemSequence() {
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(5);
|
||||
setUnlocalizedName("sequence");
|
||||
setCreativeTab(GeneticsCreativeTab.instance);
|
||||
}
|
||||
|
||||
public static ItemStack create(IGene gene) {
|
||||
return create(gene, false);
|
||||
}
|
||||
public static ItemStack create(IGene gene) {
|
||||
return create(gene, false);
|
||||
}
|
||||
|
||||
public static ItemStack create(IGene gene, boolean sequenced) {
|
||||
ItemStack item = new ItemStack(Genetics.itemSequencer);
|
||||
item.setItemDamage(sequenced ? 0 : item.getMaxDamage());
|
||||
SequencerItem seq = new SequencerItem(gene);
|
||||
seq.writeToItem(item);
|
||||
return item;
|
||||
}
|
||||
public static ItemStack create(IGene gene, boolean sequenced) {
|
||||
ItemStack item = new ItemStack(Genetics.itemSequencer);
|
||||
item.setItemDamage(sequenced ? 0 : item.getMaxDamage());
|
||||
SequencerItem seq = new SequencerItem(gene);
|
||||
seq.writeToItem(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
GeneItem gene = new GeneItem(stack);
|
||||
if (gene.isCorrupted()) {
|
||||
return I18N.localise("genetics.sequence.corrupted");
|
||||
}
|
||||
return I18N.localise("genetics.sequence.descriptor", gene.getBreedingSystem().getDescriptor());
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
GeneItem gene = new GeneItem(stack);
|
||||
if (gene.isCorrupted()) {
|
||||
return I18N.localise("genetics.sequence.corrupted");
|
||||
}
|
||||
return I18N.localise(
|
||||
"genetics.sequence.descriptor", gene.getBreedingSystem().getDescriptor());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
tooltip.add(I18N.localise("genetics.item.sequence." + (5 - stack.getItemDamage() % 6)));
|
||||
SequencerItem gene = new SequencerItem(stack);
|
||||
if (gene.isCorrupted()) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
tooltip.add(I18N.localise("genetics.item.sequence." + (5 - stack.getItemDamage() % 6)));
|
||||
SequencerItem gene = new SequencerItem(stack);
|
||||
if (gene.isCorrupted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gene.analysed) {
|
||||
gene.getInfo(tooltip);
|
||||
} else {
|
||||
tooltip.add(I18N.localise("genetics.sequence.unknown"));
|
||||
}
|
||||
if (gene.analysed) {
|
||||
gene.getInfo(tooltip);
|
||||
} else {
|
||||
tooltip.add(I18N.localise("genetics.sequence.unknown"));
|
||||
}
|
||||
|
||||
int seq = gene.sequenced;
|
||||
if (seq == 0) {
|
||||
tooltip.add(I18N.localise("genetics.sequence.unsequenced"));
|
||||
} else if (seq < 100) {
|
||||
tooltip.add(I18N.localise("genetics.sequence.partially", seq));
|
||||
} else {
|
||||
tooltip.add(I18N.localise("genetics.sequence.fully"));
|
||||
}
|
||||
}
|
||||
int seq = gene.sequenced;
|
||||
if (seq == 0) {
|
||||
tooltip.add(I18N.localise("genetics.sequence.unsequenced"));
|
||||
} else if (seq < 100) {
|
||||
tooltip.add(I18N.localise("genetics.sequence.partially", seq));
|
||||
} else {
|
||||
tooltip.add(I18N.localise("genetics.sequence.fully"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Genetics.proxy.getIcon(register, "sequencer");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Genetics.proxy.getIcon(register, "sequencer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
IAlleleBeeSpecies species = (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele("forestry.speciesMeadows");
|
||||
list.add(create(new Gene(species, EnumBeeChromosome.SPECIES, Binnie.Genetics.getBeeRoot()), false));
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
IAlleleBeeSpecies species =
|
||||
(IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele("forestry.speciesMeadows");
|
||||
list.add(create(new Gene(species, EnumBeeChromosome.SPECIES, Binnie.Genetics.getBeeRoot()), false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnalysed(ItemStack stack) {
|
||||
SequencerItem seq = new SequencerItem(stack);
|
||||
return seq.isCorrupted() || seq.analysed;
|
||||
}
|
||||
@Override
|
||||
public boolean isAnalysed(ItemStack stack) {
|
||||
SequencerItem seq = new SequencerItem(stack);
|
||||
return seq.isCorrupted() || seq.analysed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack analyse(ItemStack stack) {
|
||||
SequencerItem seq = new SequencerItem(stack);
|
||||
seq.analysed = true;
|
||||
seq.writeToItem(stack);
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
public ItemStack analyse(ItemStack stack) {
|
||||
SequencerItem seq = new SequencerItem(stack);
|
||||
seq.analysed = true;
|
||||
seq.writeToItem(stack);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAnalyseTimeMult(ItemStack stack) {
|
||||
return 1.0f;
|
||||
}
|
||||
@Override
|
||||
public float getAnalyseTimeMult(ItemStack stack) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharges(ItemStack stack) {
|
||||
return stack.getItem().getMaxDamage() - stack.getItemDamage();
|
||||
}
|
||||
@Override
|
||||
public int getCharges(ItemStack stack) {
|
||||
return stack.getItem().getMaxDamage() - stack.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,5 @@
|
||||
package binnie.genetics.item;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.genetics.Gene;
|
||||
@@ -24,88 +11,98 @@ import binnie.genetics.genetics.GeneItem;
|
||||
import binnie.genetics.genetics.IGeneItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemSerum extends ItemGene implements IItemSerum {
|
||||
public ItemSerum() {
|
||||
super("serum");
|
||||
setMaxDamage(16);
|
||||
}
|
||||
public ItemSerum() {
|
||||
super("serum");
|
||||
setMaxDamage(16);
|
||||
}
|
||||
|
||||
public static ItemStack create(IGene gene) {
|
||||
ItemStack item = new ItemStack(Genetics.itemSerum);
|
||||
item.setItemDamage(item.getMaxDamage());
|
||||
GeneItem seq = new GeneItem(gene);
|
||||
seq.writeToItem(item);
|
||||
return item;
|
||||
}
|
||||
public static ItemStack create(IGene gene) {
|
||||
ItemStack item = new ItemStack(Genetics.itemSerum);
|
||||
item.setItemDamage(item.getMaxDamage());
|
||||
GeneItem seq = new GeneItem(gene);
|
||||
seq.writeToItem(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharges(ItemStack stack) {
|
||||
return stack.getItem().getMaxDamage() - stack.getItemDamage();
|
||||
}
|
||||
@Override
|
||||
public int getCharges(ItemStack stack) {
|
||||
return stack.getItem().getMaxDamage() - stack.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
Map<IChromosomeType, List<IAllele>> chromosomeMap = Binnie.Genetics.getChromosomeMap(root);
|
||||
for (Map.Entry<IChromosomeType, List<IAllele>> entry : chromosomeMap.entrySet()) {
|
||||
IChromosomeType chromosome = entry.getKey();
|
||||
for (IAllele allele : entry.getValue()) {
|
||||
Gene gene = Gene.create(allele, chromosome, root);
|
||||
if (gene == null) {
|
||||
continue;
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
Map<IChromosomeType, List<IAllele>> chromosomeMap = Binnie.Genetics.getChromosomeMap(root);
|
||||
for (Map.Entry<IChromosomeType, List<IAllele>> entry : chromosomeMap.entrySet()) {
|
||||
IChromosomeType chromosome = entry.getKey();
|
||||
for (IAllele allele : entry.getValue()) {
|
||||
Gene gene = Gene.create(allele, chromosome, root);
|
||||
if (gene == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IGeneItem geneItem = new GeneItem(gene);
|
||||
ItemStack stack = new ItemStack(this);
|
||||
geneItem.writeToItem(stack);
|
||||
list.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
IGeneItem geneItem = new GeneItem(gene);
|
||||
ItemStack stack = new ItemStack(this);
|
||||
geneItem.writeToItem(stack);
|
||||
list.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGene[] getGenes(ItemStack stack) {
|
||||
return new IGene[]{getGeneItem(stack).getGene()};
|
||||
}
|
||||
@Override
|
||||
public IGene[] getGenes(ItemStack stack) {
|
||||
return new IGene[] {getGeneItem(stack).getGene()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot(ItemStack stack) {
|
||||
return getGeneItem(stack).getSpeciesRoot();
|
||||
}
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot(ItemStack stack) {
|
||||
return getGeneItem(stack).getSpeciesRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGene getGene(ItemStack stack, int chromosome) {
|
||||
return getGeneItem(stack).getGene();
|
||||
}
|
||||
@Override
|
||||
public IGene getGene(ItemStack stack, int chromosome) {
|
||||
return getGeneItem(stack).getGene();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneItem getGeneItem(ItemStack stack) {
|
||||
return new GeneItem(stack);
|
||||
}
|
||||
@Override
|
||||
public GeneItem getGeneItem(ItemStack stack) {
|
||||
return new GeneItem(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
IGeneItem gene = getGeneItem(stack);
|
||||
BreedingSystem breedingSystem = Binnie.Genetics.getSystem(gene.getSpeciesRoot());
|
||||
if (breedingSystem != null) {
|
||||
return I18N.localise("genetics.item.serum.name", breedingSystem.getDescriptor());
|
||||
}
|
||||
return I18N.localise("genetics.item.serumEmpty.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
IGeneItem gene = getGeneItem(stack);
|
||||
BreedingSystem breedingSystem = Binnie.Genetics.getSystem(gene.getSpeciesRoot());
|
||||
if (breedingSystem != null) {
|
||||
return I18N.localise("genetics.item.serum.name", breedingSystem.getDescriptor());
|
||||
}
|
||||
return I18N.localise("genetics.item.serumEmpty.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addGene(ItemStack stack, IGene gene) {
|
||||
IGeneItem geneItem = getGeneItem(stack);
|
||||
geneItem.addGene(gene);
|
||||
geneItem.writeToItem(stack);
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
public ItemStack addGene(ItemStack stack, IGene gene) {
|
||||
IGeneItem geneItem = getGeneItem(stack);
|
||||
geneItem.addGene(gene);
|
||||
geneItem.writeToItem(stack);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,5 @@
|
||||
package binnie.genetics.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.genetics.Gene;
|
||||
@@ -26,104 +11,116 @@ import binnie.genetics.genetics.GeneArrayItem;
|
||||
import binnie.genetics.genetics.IGeneItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemSerumArray extends ItemGene implements IItemSerum {
|
||||
public ItemSerumArray() {
|
||||
super("serumArray");
|
||||
setMaxDamage(16);
|
||||
}
|
||||
public ItemSerumArray() {
|
||||
super("serumArray");
|
||||
setMaxDamage(16);
|
||||
}
|
||||
|
||||
public static ItemStack create(IGene gene) {
|
||||
ItemStack item = new ItemStack(Genetics.itemSerumArray);
|
||||
item.setItemDamage(item.getMaxDamage());
|
||||
GeneArrayItem seq = new GeneArrayItem(gene);
|
||||
seq.writeToItem(item);
|
||||
return item;
|
||||
}
|
||||
public static ItemStack create(IGene gene) {
|
||||
ItemStack item = new ItemStack(Genetics.itemSerumArray);
|
||||
item.setItemDamage(item.getMaxDamage());
|
||||
GeneArrayItem seq = new GeneArrayItem(gene);
|
||||
seq.writeToItem(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharges(ItemStack stack) {
|
||||
return stack.getItem().getMaxDamage() - stack.getItemDamage();
|
||||
}
|
||||
@Override
|
||||
public int getCharges(ItemStack stack) {
|
||||
return stack.getItem().getMaxDamage() - stack.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGene[] getGenes(ItemStack stack) {
|
||||
return getGeneItem(stack).getGenes().toArray(new IGene[0]);
|
||||
}
|
||||
@Override
|
||||
public IGene[] getGenes(ItemStack stack) {
|
||||
return getGeneItem(stack).getGenes().toArray(new IGene[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot(ItemStack stack) {
|
||||
return getGeneItem(stack).getSpeciesRoot();
|
||||
}
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot(ItemStack stack) {
|
||||
return getGeneItem(stack).getSpeciesRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGene getGene(ItemStack stack, int chromosome) {
|
||||
return getGeneItem(stack).getGene(chromosome);
|
||||
}
|
||||
@Override
|
||||
public IGene getGene(ItemStack stack, int chromosome) {
|
||||
return getGeneItem(stack).getGene(chromosome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneArrayItem getGeneItem(ItemStack stack) {
|
||||
return new GeneArrayItem(stack);
|
||||
}
|
||||
@Override
|
||||
public GeneArrayItem getGeneItem(ItemStack stack) {
|
||||
return new GeneArrayItem(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
for (IIndividual template : root.getIndividualTemplates()) {
|
||||
if (template.getGenome().getPrimary().isSecret()) {
|
||||
continue;
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
for (IIndividual template : root.getIndividualTemplates()) {
|
||||
if (template.getGenome().getPrimary().isSecret()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IGeneItem geneItem = new GeneArrayItem();
|
||||
for (IChromosomeType type : root.getKaryotype()) {
|
||||
IChromosome c = template.getGenome().getChromosomes()[type.ordinal()];
|
||||
if (c == null) {
|
||||
continue;
|
||||
}
|
||||
IGeneItem geneItem = new GeneArrayItem();
|
||||
for (IChromosomeType type : root.getKaryotype()) {
|
||||
IChromosome c = template.getGenome().getChromosomes()[type.ordinal()];
|
||||
if (c == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IAllele active = c.getActiveAllele();
|
||||
if (active != null) {
|
||||
geneItem.addGene(new Gene(active, type, root));
|
||||
}
|
||||
}
|
||||
IAllele active = c.getActiveAllele();
|
||||
if (active != null) {
|
||||
geneItem.addGene(new Gene(active, type, root));
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack array = new ItemStack(this);
|
||||
geneItem.writeToItem(array);
|
||||
list.add(array);
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemStack array = new ItemStack(this);
|
||||
geneItem.writeToItem(array);
|
||||
list.add(array);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icons[0] = Genetics.proxy.getIcon(register, "machines/genome.glass");
|
||||
icons[1] = Genetics.proxy.getIcon(register, "machines/genome.cap");
|
||||
icons[2] = Genetics.proxy.getIcon(register, "machines/genome.edges");
|
||||
icons[3] = Genetics.proxy.getIcon(register, "machines/genome.dna");
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icons[0] = Genetics.proxy.getIcon(register, "machines/genome.glass");
|
||||
icons[1] = Genetics.proxy.getIcon(register, "machines/genome.cap");
|
||||
icons[2] = Genetics.proxy.getIcon(register, "machines/genome.edges");
|
||||
icons[3] = Genetics.proxy.getIcon(register, "machines/genome.dna");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
IGeneItem gene = getGeneItem(stack);
|
||||
BreedingSystem breedingSystem = Binnie.Genetics.getSystem(gene.getSpeciesRoot());
|
||||
if (breedingSystem != null) {
|
||||
return I18N.localise("genetics.item.serumArray.name", breedingSystem.getDescriptor());
|
||||
}
|
||||
return I18N.localise("genetics.item.genomeEmpty.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
IGeneItem gene = getGeneItem(stack);
|
||||
BreedingSystem breedingSystem = Binnie.Genetics.getSystem(gene.getSpeciesRoot());
|
||||
if (breedingSystem != null) {
|
||||
return I18N.localise("genetics.item.serumArray.name", breedingSystem.getDescriptor());
|
||||
}
|
||||
return I18N.localise("genetics.item.genomeEmpty.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack addGene(ItemStack stack, IGene gene) {
|
||||
IGeneItem geneI = getGeneItem(stack);
|
||||
geneI.addGene(gene);
|
||||
geneI.writeToItem(stack);
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
public ItemStack addGene(ItemStack stack, IGene gene) {
|
||||
IGeneItem geneI = getGeneItem(stack);
|
||||
geneI.addGene(gene);
|
||||
geneI.writeToItem(stack);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -21,259 +21,310 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
public class ModuleItem implements IInitializable {
|
||||
public static BinnieIcon iconNight;
|
||||
public static BinnieIcon iconDaytime;
|
||||
public static BinnieIcon iconAllDay;
|
||||
public static BinnieIcon iconRain;
|
||||
public static BinnieIcon iconNoRain;
|
||||
public static BinnieIcon iconSky;
|
||||
public static BinnieIcon iconNoSky;
|
||||
public static BinnieIcon iconFire;
|
||||
public static BinnieIcon iconNoFire;
|
||||
public static BinnieIcon iconAdd;
|
||||
public static BinnieIcon iconArrow;
|
||||
public static BinnieIcon iconAdd0;
|
||||
public static BinnieIcon iconArrow0;
|
||||
public static BinnieIcon iconAdd1;
|
||||
public static BinnieIcon iconArrow1;
|
||||
public static BinnieIcon iconNight;
|
||||
public static BinnieIcon iconDaytime;
|
||||
public static BinnieIcon iconAllDay;
|
||||
public static BinnieIcon iconRain;
|
||||
public static BinnieIcon iconNoRain;
|
||||
public static BinnieIcon iconSky;
|
||||
public static BinnieIcon iconNoSky;
|
||||
public static BinnieIcon iconFire;
|
||||
public static BinnieIcon iconNoFire;
|
||||
public static BinnieIcon iconAdd;
|
||||
public static BinnieIcon iconArrow;
|
||||
public static BinnieIcon iconAdd0;
|
||||
public static BinnieIcon iconArrow0;
|
||||
public static BinnieIcon iconAdd1;
|
||||
public static BinnieIcon iconArrow1;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
Genetics.itemSerum = new ItemSerum();
|
||||
Genetics.itemSerumArray = new ItemSerumArray();
|
||||
Genetics.itemSequencer = new ItemSequence();
|
||||
Genetics.itemGenetics = Binnie.Item.registerMiscItems(GeneticsItems.values(), GeneticsCreativeTab.instance);
|
||||
Genetics.database = new ItemDatabase();
|
||||
Genetics.analyst = new ItemAnalyst();
|
||||
Genetics.registry = new ItemRegistry();
|
||||
Genetics.masterRegistry = new ItemMasterRegistry();
|
||||
Binnie.Liquid.createLiquids(GeneticLiquid.values(), ItemFluidContainer.LiquidGenetics);
|
||||
}
|
||||
@Override
|
||||
public void preInit() {
|
||||
Genetics.itemSerum = new ItemSerum();
|
||||
Genetics.itemSerumArray = new ItemSerumArray();
|
||||
Genetics.itemSequencer = new ItemSequence();
|
||||
Genetics.itemGenetics = Binnie.Item.registerMiscItems(GeneticsItems.values(), GeneticsCreativeTab.instance);
|
||||
Genetics.database = new ItemDatabase();
|
||||
Genetics.analyst = new ItemAnalyst();
|
||||
Genetics.registry = new ItemRegistry();
|
||||
Genetics.masterRegistry = new ItemMasterRegistry();
|
||||
Binnie.Liquid.createLiquids(GeneticLiquid.values(), ItemFluidContainer.LiquidGenetics);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
ModuleItem.iconNight = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.night");
|
||||
ModuleItem.iconDaytime = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.day");
|
||||
ModuleItem.iconAllDay = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.allday");
|
||||
ModuleItem.iconRain = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.rain");
|
||||
ModuleItem.iconNoRain = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.norain");
|
||||
ModuleItem.iconSky = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.sky");
|
||||
ModuleItem.iconNoSky = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.nosky");
|
||||
ModuleItem.iconFire = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.fire");
|
||||
ModuleItem.iconNoFire = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.nofire");
|
||||
ModuleItem.iconAdd = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.add");
|
||||
ModuleItem.iconArrow = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.arrow");
|
||||
ModuleItem.iconAdd0 = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.add.0");
|
||||
ModuleItem.iconArrow0 = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.arrow.0");
|
||||
ModuleItem.iconAdd1 = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.add.1");
|
||||
ModuleItem.iconArrow1 = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.arrow.1");
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
ModuleItem.iconNight = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.night");
|
||||
ModuleItem.iconDaytime = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.day");
|
||||
ModuleItem.iconAllDay = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.allday");
|
||||
ModuleItem.iconRain = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.rain");
|
||||
ModuleItem.iconNoRain = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.norain");
|
||||
ModuleItem.iconSky = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.sky");
|
||||
ModuleItem.iconNoSky = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.nosky");
|
||||
ModuleItem.iconFire = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.fire");
|
||||
ModuleItem.iconNoFire = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.nofire");
|
||||
ModuleItem.iconAdd = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.add");
|
||||
ModuleItem.iconArrow = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.arrow");
|
||||
ModuleItem.iconAdd0 = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.add.0");
|
||||
ModuleItem.iconArrow0 = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.arrow.0");
|
||||
ModuleItem.iconAdd1 = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.add.1");
|
||||
ModuleItem.iconArrow1 = Binnie.Resource.getItemIcon(BinnieCore.instance, "gui/analyst.arrow.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addShapelessRecipe(
|
||||
GeneticsItems.DNADye.get(8),
|
||||
Items.glowstone_dust,
|
||||
new ItemStack(Items.dye, 1, 5)
|
||||
);
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addShapelessRecipe(
|
||||
GeneticsItems.DNADye.get(8), Items.glowstone_dust, new ItemStack(Items.dye, 1, 5));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.LaboratoryCasing.get(1),
|
||||
new Object[]{
|
||||
"iii", "iYi", "iii",
|
||||
'i', "ingotIron",
|
||||
'Y', Mods.forestry.item("sturdyMachine")
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.LaboratoryCasing.get(1),
|
||||
new Object[] {"iii", "iYi", "iii", 'i', "ingotIron", 'Y', Mods.forestry.item("sturdyMachine")}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
GeneticsItems.DNADye.get(2),
|
||||
new Object[]{
|
||||
"dyePurple",
|
||||
"dyeMagenta",
|
||||
"dyePink"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
GeneticsItems.DNADye.get(2), new Object[] {"dyePurple", "dyeMagenta", "dyePink"}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
GeneticsItems.FluorescentDye.get(2),
|
||||
new Object[]{
|
||||
"dyeOrange",
|
||||
"dyeYellow",
|
||||
"dustGlowstone"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
GeneticsItems.FluorescentDye.get(2), new Object[] {"dyeOrange", "dyeYellow", "dustGlowstone"}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
GeneticsItems.GrowthMedium.get(2),
|
||||
new Object[]{
|
||||
new ItemStack(Items.dye, 1, 15),
|
||||
Items.sugar
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
GeneticsItems.GrowthMedium.get(2), new Object[] {new ItemStack(Items.dye, 1, 15), Items.sugar}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.EmptySequencer.get(1),
|
||||
new Object[]{
|
||||
" p ", "iGi", " p ",
|
||||
'i', "ingotGold",
|
||||
'G', Blocks.glass_pane,
|
||||
'p', Items.paper
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.EmptySequencer.get(1),
|
||||
new Object[] {" p ", "iGi", " p ", 'i', "ingotGold", 'G', Blocks.glass_pane, 'p', Items.paper}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.EmptySerum.get(1),
|
||||
new Object[]{
|
||||
" g ", " G ", "GGG",
|
||||
'g', "ingotGold",
|
||||
'G', Blocks.glass_pane
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.EmptySerum.get(1),
|
||||
new Object[] {" g ", " G ", "GGG", 'g', "ingotGold", 'G', Blocks.glass_pane}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.EmptyGenome.get(1),
|
||||
new Object[]{
|
||||
"sss", "sss", "sss",
|
||||
's', GeneticsItems.EmptySerum.get(1)
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.EmptyGenome.get(1),
|
||||
new Object[] {"sss", "sss", "sss", 's', GeneticsItems.EmptySerum.get(1)}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.Cylinder.get(8),
|
||||
new Object[]{
|
||||
" g ", "g g", " ",
|
||||
'g', Blocks.glass_pane
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.Cylinder.get(8), new Object[] {" g ", "g g", " ", 'g', Blocks.glass_pane}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.IntegratedCircuit.get(1),
|
||||
new Object[]{
|
||||
"l g", " c ", "g l",
|
||||
'c', Mods.forestry.stack("chipsets", 1, 1),
|
||||
'l', new ItemStack(Items.dye, 1, 4),
|
||||
'g', "dustGlowstone"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(GeneticsItems.IntegratedCircuit.get(1), new Object[] {
|
||||
"l g",
|
||||
" c ",
|
||||
"g l",
|
||||
'c',
|
||||
Mods.forestry.stack("chipsets", 1, 1),
|
||||
'l',
|
||||
new ItemStack(Items.dye, 1, 4),
|
||||
'g',
|
||||
"dustGlowstone"
|
||||
}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.IntegratedCircuit.get(1),
|
||||
new Object[]{
|
||||
"g l", " c ", "l g",
|
||||
'c', Mods.forestry.stack("chipsets", 1, 1),
|
||||
'l', new ItemStack(Items.dye, 1, 4),
|
||||
'g', "dustGlowstone"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.IntegratedCasing.get(1),
|
||||
new Object[]{
|
||||
"ccc", "cdc", "ccc",
|
||||
'c', GeneticsItems.IntegratedCircuit.get(1),
|
||||
'd', GeneticsItems.LaboratoryCasing.get(1)
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(GeneticsItems.IntegratedCircuit.get(1), new Object[] {
|
||||
"g l",
|
||||
" c ",
|
||||
"l g",
|
||||
'c',
|
||||
Mods.forestry.stack("chipsets", 1, 1),
|
||||
'l',
|
||||
new ItemStack(Items.dye, 1, 4),
|
||||
'g',
|
||||
"dustGlowstone"
|
||||
}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(GeneticsItems.IntegratedCasing.get(1), new Object[] {
|
||||
"ccc", "cdc", "ccc", 'c', GeneticsItems.IntegratedCircuit.get(1), 'd', GeneticsItems.LaboratoryCasing.get(1)
|
||||
}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.IntegratedCPU.get(1),
|
||||
new Object[]{
|
||||
"ccc", "cdc", "ccc",
|
||||
'c', GeneticsItems.IntegratedCircuit.get(1),
|
||||
'd', Items.diamond
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticsItems.IntegratedCPU.get(1),
|
||||
new Object[] {"ccc", "cdc", "ccc", 'c', GeneticsItems.IntegratedCircuit.get(1), 'd', Items.diamond}));
|
||||
|
||||
RecipeManagers.carpenterManager.addRecipe(
|
||||
100,
|
||||
Binnie.Liquid.getLiquidStack("water", 2000),
|
||||
null,
|
||||
new ItemStack(Genetics.database),
|
||||
"X#X", "YEY", "RDR",
|
||||
'#', Blocks.glass_pane,
|
||||
'X', Items.diamond,
|
||||
'Y', Items.diamond,
|
||||
'R', Items.redstone,
|
||||
'D', Items.ender_eye,
|
||||
'E', Blocks.obsidian
|
||||
);
|
||||
RecipeManagers.carpenterManager.addRecipe(
|
||||
100,
|
||||
Binnie.Liquid.getLiquidStack("water", 2000),
|
||||
null,
|
||||
new ItemStack(Genetics.database),
|
||||
"X#X",
|
||||
"YEY",
|
||||
"RDR",
|
||||
'#',
|
||||
Blocks.glass_pane,
|
||||
'X',
|
||||
Items.diamond,
|
||||
'Y',
|
||||
Items.diamond,
|
||||
'R',
|
||||
Items.redstone,
|
||||
'D',
|
||||
Items.ender_eye,
|
||||
'E',
|
||||
Blocks.obsidian);
|
||||
|
||||
GameRegistry.addSmelting(Genetics.itemSequencer, GeneticsItems.EmptySequencer.get(1), 0.0f);
|
||||
GameRegistry.addSmelting(Genetics.itemSerum, GeneticsItems.EmptySerum.get(1), 0.0f);
|
||||
GameRegistry.addSmelting(Genetics.itemSerumArray, GeneticsItems.EmptyGenome.get(1), 0.0f);
|
||||
GameRegistry.addSmelting(Genetics.itemSequencer, GeneticsItems.EmptySequencer.get(1), 0.0f);
|
||||
GameRegistry.addSmelting(Genetics.itemSerum, GeneticsItems.EmptySerum.get(1), 0.0f);
|
||||
GameRegistry.addSmelting(Genetics.itemSerumArray, GeneticsItems.EmptyGenome.get(1), 0.0f);
|
||||
|
||||
// TODONE refactor refactor refactor this!
|
||||
// CombatZAK up to the task!
|
||||
Item beealyzer = Mods.forestry.item("beealyzer");
|
||||
Item treealyzer = Mods.forestry.item("treealyzer");
|
||||
// TODONE refactor refactor refactor this!
|
||||
// CombatZAK up to the task!
|
||||
Item beealyzer = Mods.forestry.item("beealyzer");
|
||||
Item treealyzer = Mods.forestry.item("treealyzer");
|
||||
|
||||
//This bit prevents a crash if the Forestry butterflies module is disabled. You can use whatever placeholder item you but a diamond seems reasonable
|
||||
//theoretically similar checks could be performed for Apiculture and Arboriculture; but I will leave that to the mod owner to decide
|
||||
Item flutterlyzer = BinnieCore.isLepidopteryActive() ? Mods.forestry.item("flutterlyzer") //grab the forestry flutterlyzer ONLY IF lepidopterology is active
|
||||
: Items.diamond; //otherwise just replace it with another diamond
|
||||
// This bit prevents a crash if the Forestry butterflies module is disabled. You can use whatever placeholder
|
||||
// item you but a diamond seems reasonable
|
||||
// theoretically similar checks could be performed for Apiculture and Arboriculture; but I will leave that to
|
||||
// the mod owner to decide
|
||||
Item flutterlyzer = BinnieCore.isLepidopteryActive()
|
||||
? Mods.forestry.item("flutterlyzer") // grab the forestry flutterlyzer ONLY IF lepidopterology is active
|
||||
: Items.diamond; // otherwise just replace it with another diamond
|
||||
|
||||
ItemStack circuit = GeneticsItems.IntegratedCircuit.get(1); //get a reference to Integrated circuit
|
||||
Item diamond = Items.diamond; //save a reference to diamond
|
||||
ItemStack circuit = GeneticsItems.IntegratedCircuit.get(1); // get a reference to Integrated circuit
|
||||
Item diamond = Items.diamond; // save a reference to diamond
|
||||
|
||||
ItemStack analyst = new ItemStack(Genetics.analyst); //save a reference to the analyst, will make the next bit easier
|
||||
ItemStack analyst =
|
||||
new ItemStack(Genetics.analyst); // save a reference to the analyst, will make the next bit easier
|
||||
|
||||
//the following code is a sufficient replacement for the 3 nested loops that preceded it; arguably this is still
|
||||
//more trouble than it's worth. A single recipe is probably fine, with the analyzers in a specific arrangement,
|
||||
//but I will leave it to the mod owner to make that call
|
||||
// the following code is a sufficient replacement for the 3 nested loops that preceded it; arguably this is
|
||||
// still
|
||||
// more trouble than it's worth. A single recipe is probably fine, with the analyzers in a specific arrangement,
|
||||
// but I will leave it to the mod owner to make that call
|
||||
|
||||
//there are literally only six permutations for this recipe, so let's just write them all out and save ourselves
|
||||
//some cycles rather than spinning through an n^3 loop wasting most of the combinations.
|
||||
//expand the first one out for readability, but the following five are compressed to a single line
|
||||
GameRegistry.addShapedRecipe(analyst,
|
||||
" b ", "tcf", " d ",
|
||||
'b', beealyzer,
|
||||
't', treealyzer,
|
||||
'f', flutterlyzer,
|
||||
'c', circuit,
|
||||
'd', diamond);
|
||||
// there are literally only six permutations for this recipe, so let's just write them all out and save
|
||||
// ourselves
|
||||
// some cycles rather than spinning through an n^3 loop wasting most of the combinations.
|
||||
// expand the first one out for readability, but the following five are compressed to a single line
|
||||
GameRegistry.addShapedRecipe(
|
||||
analyst,
|
||||
" b ",
|
||||
"tcf",
|
||||
" d ",
|
||||
'b',
|
||||
beealyzer,
|
||||
't',
|
||||
treealyzer,
|
||||
'f',
|
||||
flutterlyzer,
|
||||
'c',
|
||||
circuit,
|
||||
'd',
|
||||
diamond);
|
||||
|
||||
GameRegistry.addShapedRecipe(analyst, " b ", "fct", " d ", 'b', beealyzer, 't', treealyzer, 'f', flutterlyzer, 'c', circuit, 'd', diamond);
|
||||
GameRegistry.addShapedRecipe(analyst, " t ", "bcf", " d ", 'b', beealyzer, 't', treealyzer, 'f', flutterlyzer, 'c', circuit, 'd', diamond);
|
||||
GameRegistry.addShapedRecipe(analyst, " t ", "fcb", " d ", 'b', beealyzer, 't', treealyzer, 'f', flutterlyzer, 'c', circuit, 'd', diamond);
|
||||
GameRegistry.addShapedRecipe(analyst, " f ", "bct", " d ", 'b', beealyzer, 't', treealyzer, 'f', flutterlyzer, 'c', circuit, 'd', diamond);
|
||||
GameRegistry.addShapedRecipe(analyst, " f ", "tcb", " d ", 'b', beealyzer, 't', treealyzer, 'f', flutterlyzer, 'c', circuit, 'd', diamond);
|
||||
GameRegistry.addShapedRecipe(
|
||||
analyst,
|
||||
" b ",
|
||||
"fct",
|
||||
" d ",
|
||||
'b',
|
||||
beealyzer,
|
||||
't',
|
||||
treealyzer,
|
||||
'f',
|
||||
flutterlyzer,
|
||||
'c',
|
||||
circuit,
|
||||
'd',
|
||||
diamond);
|
||||
GameRegistry.addShapedRecipe(
|
||||
analyst,
|
||||
" t ",
|
||||
"bcf",
|
||||
" d ",
|
||||
'b',
|
||||
beealyzer,
|
||||
't',
|
||||
treealyzer,
|
||||
'f',
|
||||
flutterlyzer,
|
||||
'c',
|
||||
circuit,
|
||||
'd',
|
||||
diamond);
|
||||
GameRegistry.addShapedRecipe(
|
||||
analyst,
|
||||
" t ",
|
||||
"fcb",
|
||||
" d ",
|
||||
'b',
|
||||
beealyzer,
|
||||
't',
|
||||
treealyzer,
|
||||
'f',
|
||||
flutterlyzer,
|
||||
'c',
|
||||
circuit,
|
||||
'd',
|
||||
diamond);
|
||||
GameRegistry.addShapedRecipe(
|
||||
analyst,
|
||||
" f ",
|
||||
"bct",
|
||||
" d ",
|
||||
'b',
|
||||
beealyzer,
|
||||
't',
|
||||
treealyzer,
|
||||
'f',
|
||||
flutterlyzer,
|
||||
'c',
|
||||
circuit,
|
||||
'd',
|
||||
diamond);
|
||||
GameRegistry.addShapedRecipe(
|
||||
analyst,
|
||||
" f ",
|
||||
"tcb",
|
||||
" d ",
|
||||
'b',
|
||||
beealyzer,
|
||||
't',
|
||||
treealyzer,
|
||||
'f',
|
||||
flutterlyzer,
|
||||
'c',
|
||||
circuit,
|
||||
'd',
|
||||
diamond);
|
||||
|
||||
//get some references to dictionary/databases for the various modules; these names are very inconsistent for like items.
|
||||
//should be refactored in their respective modules.
|
||||
ItemStack registry = new ItemStack(Genetics.registry);
|
||||
Item beeDb = ExtraBees.dictionary;
|
||||
Item treeDb = ExtraTrees.itemDictionary;
|
||||
Item flwrDb = Botany.database;
|
||||
// get some references to dictionary/databases for the various modules; these names are very inconsistent for
|
||||
// like items.
|
||||
// should be refactored in their respective modules.
|
||||
ItemStack registry = new ItemStack(Genetics.registry);
|
||||
Item beeDb = ExtraBees.dictionary;
|
||||
Item treeDb = ExtraTrees.itemDictionary;
|
||||
Item flwrDb = Botany.database;
|
||||
|
||||
//do a check to ensure that the butterfly module is enabled before using the butterfly dictionary.
|
||||
//a similar check could be done for arboriculture and apiculture as well, but that is left to the mod owner
|
||||
Item lepiDb = BinnieCore.isLepidopteryActive() ? ExtraTrees.itemDictionaryLepi
|
||||
: Items.diamond; //just use a diamond if Butterflies is disabled
|
||||
//going to use the circuit reference above as well
|
||||
// do a check to ensure that the butterfly module is enabled before using the butterfly dictionary.
|
||||
// a similar check could be done for arboriculture and apiculture as well, but that is left to the mod owner
|
||||
Item lepiDb = BinnieCore.isLepidopteryActive()
|
||||
? ExtraTrees.itemDictionaryLepi
|
||||
: Items.diamond; // just use a diamond if Butterflies is disabled
|
||||
// going to use the circuit reference above as well
|
||||
|
||||
//as above, there are only 24 permutations here; let's find a way to just get those recipes rather than trying
|
||||
//256 combinations in an n^4 loop. This will help performance and maybe be a bit more maintainable.
|
||||
if (BinnieCore.isBotanyActive() && BinnieCore.isExtraBeesActive() && BinnieCore.isExtraTreesActive()) {
|
||||
//24 full recipe lines is a bit much to maintain; so we'll use a loop here, but we're only going
|
||||
//to run it 24 times. Start by making an array of all 24 valid dictionary permutations...
|
||||
String[] permutations = new String[]{
|
||||
"btlf", "btfl", "bltf", "blft", "bftl", "bflt",
|
||||
"tblf", "tbfl", "tlbf", "tlfb", "tfbl", "tflb",
|
||||
"lbtf", "lbft", "ltbf", "ltfb", "lfbt", "lftb",
|
||||
"fbtl", "fblt", "ftbl", "ftlb", "flbt", "fltb"
|
||||
};
|
||||
// as above, there are only 24 permutations here; let's find a way to just get those recipes rather than trying
|
||||
// 256 combinations in an n^4 loop. This will help performance and maybe be a bit more maintainable.
|
||||
if (BinnieCore.isBotanyActive() && BinnieCore.isExtraBeesActive() && BinnieCore.isExtraTreesActive()) {
|
||||
// 24 full recipe lines is a bit much to maintain; so we'll use a loop here, but we're only going
|
||||
// to run it 24 times. Start by making an array of all 24 valid dictionary permutations...
|
||||
String[] permutations = new String[] {
|
||||
"btlf", "btfl", "bltf", "blft", "bftl", "bflt",
|
||||
"tblf", "tbfl", "tlbf", "tlfb", "tfbl", "tflb",
|
||||
"lbtf", "lbft", "ltbf", "ltfb", "lfbt", "lftb",
|
||||
"fbtl", "fblt", "ftbl", "ftlb", "flbt", "fltb"
|
||||
};
|
||||
|
||||
//now go through each of the permutations and create a recipe
|
||||
for (String p : permutations) {
|
||||
GameRegistry.addShapedRecipe(registry, //adding the recipe with registry as output
|
||||
//this line is the 3-string arrangement, with the characters pulled from the current permutation
|
||||
String.format(" %c ", p.charAt(0)), String.format("%cc%c", p.charAt(1), p.charAt(2)), String.format(" %c ", p.charAt(3)),
|
||||
'b', beeDb,
|
||||
't', treeDb,
|
||||
'l', lepiDb,
|
||||
'f', flwrDb,
|
||||
'c', circuit);
|
||||
}
|
||||
}
|
||||
}
|
||||
// now go through each of the permutations and create a recipe
|
||||
for (String p : permutations) {
|
||||
GameRegistry.addShapedRecipe(
|
||||
registry, // adding the recipe with registry as output
|
||||
// this line is the 3-string arrangement, with the characters pulled from the current
|
||||
// permutation
|
||||
String.format(" %c ", p.charAt(0)),
|
||||
String.format("%cc%c", p.charAt(1), p.charAt(2)),
|
||||
String.format(" %c ", p.charAt(3)),
|
||||
'b',
|
||||
beeDb,
|
||||
't',
|
||||
treeDb,
|
||||
'l',
|
||||
lepiDb,
|
||||
'f',
|
||||
flwrDb,
|
||||
'c',
|
||||
circuit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,31 +8,31 @@ import binnie.genetics.machine.splicer.SplicerPackage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public enum AdvGeneticMachine implements IMachineType {
|
||||
Splicer(SplicerPackage.class);
|
||||
Splicer(SplicerPackage.class);
|
||||
|
||||
protected Class<? extends MachinePackage> cls;
|
||||
protected Class<? extends MachinePackage> cls;
|
||||
|
||||
AdvGeneticMachine(Class<? extends MachinePackage> cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
AdvGeneticMachine(Class<? extends MachinePackage> cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends MachinePackage> getPackageClass() {
|
||||
return cls;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends MachinePackage> getPackageClass() {
|
||||
return cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack get(int i) {
|
||||
return new ItemStack(Genetics.packageAdvGenetic.getBlock(), i, ordinal());
|
||||
}
|
||||
public ItemStack get(int i) {
|
||||
return new ItemStack(Genetics.packageAdvGenetic.getBlock(), i, ordinal());
|
||||
}
|
||||
|
||||
public abstract static class PackageAdvGeneticBase extends PackageGeneticBase {
|
||||
protected PackageAdvGeneticBase(String uid, IBinnieTexture renderTexture, int flashColor, boolean powered) {
|
||||
super(uid, renderTexture, flashColor, powered);
|
||||
}
|
||||
}
|
||||
public abstract static class PackageAdvGeneticBase extends PackageGeneticBase {
|
||||
protected PackageAdvGeneticBase(String uid, IBinnieTexture renderTexture, int flashColor, boolean powered) {
|
||||
super(uid, renderTexture, flashColor, powered);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import binnie.extrabees.ExtraBees;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.genetics.Genetics;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -18,131 +21,128 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class ComponentGUIHolder extends MachineComponent implements INetwork.TilePacketSync, IInteraction.RightClick {
|
||||
private ItemStack stack;
|
||||
private ItemStack stack;
|
||||
|
||||
public ComponentGUIHolder(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
public ComponentGUIHolder(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
return;
|
||||
}
|
||||
stack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Item"));
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
return;
|
||||
}
|
||||
stack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Item"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if (stack != null) {
|
||||
stack.writeToNBT(nbt);
|
||||
}
|
||||
nbttagcompound.setTag("Item", nbt);
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if (stack != null) {
|
||||
stack.writeToNBT(nbt);
|
||||
}
|
||||
nbttagcompound.setTag("Item", nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToNBT(NBTTagCompound nbt) {
|
||||
writeToNBT(nbt);
|
||||
}
|
||||
@Override
|
||||
public void syncToNBT(NBTTagCompound nbt) {
|
||||
writeToNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
readFromNBT(nbt);
|
||||
}
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestruction() {
|
||||
super.onDestruction();
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IMachine machine = getMachine();
|
||||
TileEntity tile = machine.getTileEntity();
|
||||
World world = machine.getWorld();
|
||||
Random rand = world.rand;
|
||||
float xOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
float yOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
float zOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
if (stack.stackSize == 0) {
|
||||
stack.stackSize = 1;
|
||||
}
|
||||
@Override
|
||||
public void onDestruction() {
|
||||
super.onDestruction();
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityItem entityitem = new EntityItem(world, tile.xCoord + xOffset, tile.yCoord + yOffset, tile.zCoord + zOffset, stack.copy());
|
||||
float accel = 0.05f;
|
||||
entityitem.motionX = (float) rand.nextGaussian() * accel;
|
||||
entityitem.motionY = (float) rand.nextGaussian() * accel + 0.2f;
|
||||
entityitem.motionZ = (float) rand.nextGaussian() * accel;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
IMachine machine = getMachine();
|
||||
TileEntity tile = machine.getTileEntity();
|
||||
World world = machine.getWorld();
|
||||
Random rand = world.rand;
|
||||
float xOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
float yOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
float zOffset = rand.nextFloat() * 0.8f + 0.1f;
|
||||
if (stack.stackSize == 0) {
|
||||
stack.stackSize = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(World world, EntityPlayer player, int x, int y, int z) {
|
||||
if (BinnieCore.proxy.isSimulating(world) && player.getHeldItem() != null) {
|
||||
if (stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
|
||||
Random rand = world.rand;
|
||||
float f = 0.7f;
|
||||
double fOffset = (1.0f - f) * 0.5;
|
||||
double xOffset = rand.nextFloat() * f + fOffset;
|
||||
double yOffset = rand.nextFloat() * f + fOffset;
|
||||
double zOffset = rand.nextFloat() * f + fOffset;
|
||||
EntityItem entityitem = new EntityItem(
|
||||
world, tile.xCoord + xOffset, tile.yCoord + yOffset, tile.zCoord + zOffset, stack.copy());
|
||||
float accel = 0.05f;
|
||||
entityitem.motionX = (float) rand.nextGaussian() * accel;
|
||||
entityitem.motionY = (float) rand.nextGaussian() * accel + 0.2f;
|
||||
entityitem.motionZ = (float) rand.nextGaussian() * accel;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
EntityItem entityitem = new EntityItem(world, x + xOffset, y + yOffset, z + zOffset, stack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
stack = null;
|
||||
((IToolWrench) player.getHeldItem().getItem()).wrenchUsed(player, x, y, z);
|
||||
getUtil().refreshBlock();
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void onRightClick(World world, EntityPlayer player, int x, int y, int z) {
|
||||
if (BinnieCore.proxy.isSimulating(world) && player.getHeldItem() != null) {
|
||||
if (stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
|
||||
Random rand = world.rand;
|
||||
float f = 0.7f;
|
||||
double fOffset = (1.0f - f) * 0.5;
|
||||
double xOffset = rand.nextFloat() * f + fOffset;
|
||||
double yOffset = rand.nextFloat() * f + fOffset;
|
||||
double zOffset = rand.nextFloat() * f + fOffset;
|
||||
|
||||
List<Item> validSelections = new ArrayList<>();
|
||||
if (BinnieCore.isBotanyActive()) {
|
||||
validSelections.add(Botany.database);
|
||||
}
|
||||
if (BinnieCore.isExtraBeesActive()) {
|
||||
validSelections.add(ExtraBees.dictionary);
|
||||
}
|
||||
if (BinnieCore.isExtraTreesActive()) {
|
||||
validSelections.add(ExtraTrees.itemDictionary);
|
||||
}
|
||||
if (BinnieCore.isLepidopteryActive()) {
|
||||
validSelections.add(ExtraTrees.itemDictionaryLepi);
|
||||
}
|
||||
EntityItem entityitem = new EntityItem(world, x + xOffset, y + yOffset, z + zOffset, stack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
stack = null;
|
||||
((IToolWrench) player.getHeldItem().getItem()).wrenchUsed(player, x, y, z);
|
||||
getUtil().refreshBlock();
|
||||
return;
|
||||
}
|
||||
|
||||
validSelections.add(Genetics.database);
|
||||
validSelections.add(Genetics.analyst);
|
||||
validSelections.add(Genetics.registry);
|
||||
validSelections.add(Genetics.masterRegistry);
|
||||
validSelections.add(BinnieCore.genesis);
|
||||
List<Item> validSelections = new ArrayList<>();
|
||||
if (BinnieCore.isBotanyActive()) {
|
||||
validSelections.add(Botany.database);
|
||||
}
|
||||
if (BinnieCore.isExtraBeesActive()) {
|
||||
validSelections.add(ExtraBees.dictionary);
|
||||
}
|
||||
if (BinnieCore.isExtraTreesActive()) {
|
||||
validSelections.add(ExtraTrees.itemDictionary);
|
||||
}
|
||||
if (BinnieCore.isLepidopteryActive()) {
|
||||
validSelections.add(ExtraTrees.itemDictionaryLepi);
|
||||
}
|
||||
|
||||
if (stack == null && validSelections.contains(player.getHeldItem().getItem())) {
|
||||
stack = player.getHeldItem().copy();
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return;
|
||||
}
|
||||
validSelections.add(Genetics.database);
|
||||
validSelections.add(Genetics.analyst);
|
||||
validSelections.add(Genetics.registry);
|
||||
validSelections.add(Genetics.masterRegistry);
|
||||
validSelections.add(BinnieCore.genesis);
|
||||
|
||||
if (stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
|
||||
stack.getItem().onItemRightClick(stack, world, player);
|
||||
}
|
||||
}
|
||||
if (stack == null && validSelections.contains(player.getHeldItem().getItem())) {
|
||||
stack = player.getHeldItem().copy();
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
stack.getItem().onItemRightClick(stack, world, player);
|
||||
}
|
||||
}
|
||||
if (stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
|
||||
stack.getItem().onItemRightClick(stack, world, player);
|
||||
}
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
stack.getItem().onItemRightClick(stack, world, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,15 +9,15 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ComponentGeneticGUI extends MachineComponent implements IInteraction.RightClick {
|
||||
public GeneticsGUI id;
|
||||
public GeneticsGUI id;
|
||||
|
||||
public ComponentGeneticGUI(Machine machine, GeneticsGUI id) {
|
||||
super(machine);
|
||||
this.id = id;
|
||||
}
|
||||
public ComponentGeneticGUI(Machine machine, GeneticsGUI id) {
|
||||
super(machine);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(World world, EntityPlayer player, int x, int y, int z) {
|
||||
Genetics.proxy.openGui(id, player, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void onRightClick(World world, EntityPlayer player, int x, int y, int z) {
|
||||
Genetics.proxy.openGui(id, player, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -10,28 +10,28 @@ import binnie.genetics.machine.sequencer.SequencerPackage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public enum GeneticMachine implements IMachineType {
|
||||
Isolator(IsolatorPackage.class),
|
||||
Sequencer(SequencerPackage.class),
|
||||
Polymeriser(PolymeriserPackage.class),
|
||||
Inoculator(InoculatorPackage.class);
|
||||
Isolator(IsolatorPackage.class),
|
||||
Sequencer(SequencerPackage.class),
|
||||
Polymeriser(PolymeriserPackage.class),
|
||||
Inoculator(InoculatorPackage.class);
|
||||
|
||||
protected Class<? extends MachinePackage> clss;
|
||||
protected Class<? extends MachinePackage> clss;
|
||||
|
||||
GeneticMachine(Class<? extends MachinePackage> clss) {
|
||||
this.clss = clss;
|
||||
}
|
||||
GeneticMachine(Class<? extends MachinePackage> clss) {
|
||||
this.clss = clss;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends MachinePackage> getPackageClass() {
|
||||
return clss;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends MachinePackage> getPackageClass() {
|
||||
return clss;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack get(int i) {
|
||||
return new ItemStack(Genetics.packageGenetic.getBlock(), i, ordinal());
|
||||
}
|
||||
public ItemStack get(int i) {
|
||||
return new ItemStack(Genetics.packageGenetic.getBlock(), i, ordinal());
|
||||
}
|
||||
}
|
||||
@@ -11,29 +11,29 @@ import binnie.genetics.machine.lab.LabMachinePackage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public enum LaboratoryMachine implements IMachineType {
|
||||
LabMachine(LabMachinePackage.class),
|
||||
Analyser(AnalyserPackage.class),
|
||||
Incubator(IncubatorPackage.class),
|
||||
Genepool(GenepoolPackage.class),
|
||||
Acclimatiser(AcclimatiserPackage.class);
|
||||
LabMachine(LabMachinePackage.class),
|
||||
Analyser(AnalyserPackage.class),
|
||||
Incubator(IncubatorPackage.class),
|
||||
Genepool(GenepoolPackage.class),
|
||||
Acclimatiser(AcclimatiserPackage.class);
|
||||
|
||||
private Class<? extends MachinePackage> clss;
|
||||
private Class<? extends MachinePackage> clss;
|
||||
|
||||
LaboratoryMachine(Class<? extends MachinePackage> clss) {
|
||||
this.clss = clss;
|
||||
}
|
||||
LaboratoryMachine(Class<? extends MachinePackage> clss) {
|
||||
this.clss = clss;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends MachinePackage> getPackageClass() {
|
||||
return clss;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends MachinePackage> getPackageClass() {
|
||||
return clss;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack get(int i) {
|
||||
return new ItemStack(Genetics.packageLabMachine.getBlock(), i, ordinal());
|
||||
}
|
||||
public ItemStack get(int i) {
|
||||
return new ItemStack(Genetics.packageLabMachine.getBlock(), i, ordinal());
|
||||
}
|
||||
}
|
||||
@@ -13,46 +13,47 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class MachineRendererGenetics {
|
||||
public static MachineRendererGenetics instance = new MachineRendererGenetics();
|
||||
public static MachineRendererGenetics instance = new MachineRendererGenetics();
|
||||
|
||||
public RenderItem customRenderItem;
|
||||
public RenderItem customRenderItem;
|
||||
|
||||
private ModelMachine model;
|
||||
private ModelMachine model;
|
||||
|
||||
public MachineRendererGenetics() {
|
||||
model = new ModelMachine();
|
||||
customRenderItem = new RenderItem() {
|
||||
@Override
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
public MachineRendererGenetics() {
|
||||
model = new ModelMachine();
|
||||
customRenderItem = new RenderItem() {
|
||||
@Override
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSpreadItems() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
customRenderItem.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
@Override
|
||||
public boolean shouldSpreadItems() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
customRenderItem.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
|
||||
public void renderMachine(Machine machine, int colour, BinnieResource texture, double x, double y, double z, float var8) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
BinnieCore.proxy.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
BinnieCore.proxy.getMinecraftInstance();
|
||||
public void renderMachine(
|
||||
Machine machine, int colour, BinnieResource texture, double x, double y, double z, float var8) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
BinnieCore.proxy.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
BinnieCore.proxy.getMinecraftInstance();
|
||||
|
||||
if (Minecraft.isFancyGraphicsEnabled()) {
|
||||
for (IRender.Render render : machine.getInterfaces(IRender.Render.class)) {
|
||||
render.renderInWorld(customRenderItem, x, y, z);
|
||||
}
|
||||
}
|
||||
if (Minecraft.isFancyGraphicsEnabled()) {
|
||||
for (IRender.Render render : machine.getInterfaces(IRender.Render.class)) {
|
||||
render.renderInWorld(customRenderItem, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -16,99 +16,103 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class MachineRendererLab {
|
||||
public static MachineRendererLab instance = new MachineRendererLab();
|
||||
public static MachineRendererLab instance = new MachineRendererLab();
|
||||
|
||||
private EntityItem dummyEntityItem;
|
||||
private EntityItem[] itemSides;
|
||||
private RenderItem customRenderItem;
|
||||
private long lastTick;
|
||||
private ModelMachine model;
|
||||
private EntityItem dummyEntityItem;
|
||||
private EntityItem[] itemSides;
|
||||
private RenderItem customRenderItem;
|
||||
private long lastTick;
|
||||
private ModelMachine model;
|
||||
|
||||
public MachineRendererLab() {
|
||||
dummyEntityItem = new EntityItem(null);
|
||||
itemSides = new EntityItem[]{new EntityItem(null), new EntityItem(null), new EntityItem(null), new EntityItem(null)};
|
||||
model = new ModelMachine();
|
||||
(customRenderItem = new RenderItem() {
|
||||
@Override
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
public MachineRendererLab() {
|
||||
dummyEntityItem = new EntityItem(null);
|
||||
itemSides =
|
||||
new EntityItem[] {new EntityItem(null), new EntityItem(null), new EntityItem(null), new EntityItem(null)
|
||||
};
|
||||
model = new ModelMachine();
|
||||
(customRenderItem = new RenderItem() {
|
||||
@Override
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSpreadItems() {
|
||||
return false;
|
||||
}
|
||||
}).setRenderManager(RenderManager.instance);
|
||||
}
|
||||
@Override
|
||||
public boolean shouldSpreadItems() {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
|
||||
public void renderMachine(Machine machine, int colour, BinnieResource texture, double x, double y, double z, float var8) {
|
||||
GL11.glPushMatrix();
|
||||
int ix = machine.getTileEntity().xCoord;
|
||||
int iz = machine.getTileEntity().zCoord;
|
||||
public void renderMachine(
|
||||
Machine machine, int colour, BinnieResource texture, double x, double y, double z, float var8) {
|
||||
GL11.glPushMatrix();
|
||||
int ix = machine.getTileEntity().xCoord;
|
||||
int iz = machine.getTileEntity().zCoord;
|
||||
|
||||
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
BinnieCore.proxy.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
World world = machine.getWorld();
|
||||
ComponentGUIHolder holder = Machine.getInterface(ComponentGUIHolder.class, machine);
|
||||
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
BinnieCore.proxy.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
World world = machine.getWorld();
|
||||
ComponentGUIHolder holder = Machine.getInterface(ComponentGUIHolder.class, machine);
|
||||
|
||||
// TODO remove label
|
||||
Label_0591:
|
||||
{
|
||||
if (world != null && holder != null && holder.getStack() != null) {
|
||||
BinnieCore.proxy.getMinecraftInstance();
|
||||
if (Minecraft.isFancyGraphicsEnabled()) {
|
||||
ItemStack stack = holder.getStack();
|
||||
dummyEntityItem.worldObj = world;
|
||||
dummyEntityItem.setEntityItemStack(stack);
|
||||
if (world.getTotalWorldTime() != lastTick) {
|
||||
lastTick = world.getTotalWorldTime();
|
||||
dummyEntityItem.onUpdate();
|
||||
}
|
||||
dummyEntityItem.age = 0;
|
||||
dummyEntityItem.hoverStart = 0.0f;
|
||||
GL11.glPushMatrix();
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
double dx = ix + 0.5 - player.lastTickPosX;
|
||||
double dz = iz + 0.5 - player.lastTickPosZ;
|
||||
double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
|
||||
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -0.55f);
|
||||
GL11.glRotatef(90.0f + (float) (-t), 0.0f, 0.0f, 1.0f);
|
||||
GL11.glTranslatef(0.0f, -0.125f, 0.0f);
|
||||
GL11.glScalef(1.2f, 1.2f, 1.2f);
|
||||
GL11.glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glTranslatef(0.0f, 0.1f, 0.1f);
|
||||
customRenderItem.doRender(dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
|
||||
GL11.glPopMatrix();
|
||||
int rot = 0;
|
||||
// TODO remove label
|
||||
Label_0591:
|
||||
{
|
||||
if (world != null && holder != null && holder.getStack() != null) {
|
||||
BinnieCore.proxy.getMinecraftInstance();
|
||||
if (Minecraft.isFancyGraphicsEnabled()) {
|
||||
ItemStack stack = holder.getStack();
|
||||
dummyEntityItem.worldObj = world;
|
||||
dummyEntityItem.setEntityItemStack(stack);
|
||||
if (world.getTotalWorldTime() != lastTick) {
|
||||
lastTick = world.getTotalWorldTime();
|
||||
dummyEntityItem.onUpdate();
|
||||
}
|
||||
dummyEntityItem.age = 0;
|
||||
dummyEntityItem.hoverStart = 0.0f;
|
||||
GL11.glPushMatrix();
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
double dx = ix + 0.5 - player.lastTickPosX;
|
||||
double dz = iz + 0.5 - player.lastTickPosZ;
|
||||
double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
|
||||
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -0.55f);
|
||||
GL11.glRotatef(90.0f + (float) (-t), 0.0f, 0.0f, 1.0f);
|
||||
GL11.glTranslatef(0.0f, -0.125f, 0.0f);
|
||||
GL11.glScalef(1.2f, 1.2f, 1.2f);
|
||||
GL11.glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glTranslatef(0.0f, 0.1f, 0.1f);
|
||||
customRenderItem.doRender(dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
|
||||
GL11.glPopMatrix();
|
||||
int rot = 0;
|
||||
|
||||
for (EntityItem item : itemSides) {
|
||||
GL11.glPushMatrix();
|
||||
item.worldObj = world;
|
||||
item.setEntityItemStack(stack);
|
||||
item.age = 0;
|
||||
item.hoverStart = 0.0f;
|
||||
GL11.glRotatef(rot, 0.0f, 1.0f, 0.0f);
|
||||
GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glTranslated(0.0, -1.13, 0.4);
|
||||
GL11.glScalef(0.8f, 0.8f, 0.8f);
|
||||
customRenderItem.doRender(item, 0.0, 0.0, 0.0, 0.0f, 0.0f);
|
||||
rot += 90;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
break Label_0591;
|
||||
}
|
||||
}
|
||||
for (EntityItem item : itemSides) {
|
||||
GL11.glPushMatrix();
|
||||
item.worldObj = world;
|
||||
item.setEntityItemStack(stack);
|
||||
item.age = 0;
|
||||
item.hoverStart = 0.0f;
|
||||
GL11.glRotatef(rot, 0.0f, 1.0f, 0.0f);
|
||||
GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glTranslated(0.0, -1.13, 0.4);
|
||||
GL11.glScalef(0.8f, 0.8f, 0.8f);
|
||||
customRenderItem.doRender(item, 0.0, 0.0, 0.0, 0.0f, 0.0f);
|
||||
rot += 90;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
break Label_0591;
|
||||
}
|
||||
}
|
||||
|
||||
dummyEntityItem.setEntityItemStack(null);
|
||||
for (EntityItem item2 : itemSides) {
|
||||
item2.setEntityItemStack(null);
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
dummyEntityItem.setEntityItemStack(null);
|
||||
for (EntityItem item2 : itemSides) {
|
||||
item2.setEntityItemStack(null);
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -4,87 +4,87 @@ import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelMachine extends ModelBase {
|
||||
private ModelRenderer base;
|
||||
private ModelRenderer body;
|
||||
private ModelRenderer arm1;
|
||||
private ModelRenderer arm2;
|
||||
private ModelRenderer arm3;
|
||||
private ModelRenderer arm4;
|
||||
private ModelRenderer top;
|
||||
private ModelRenderer base;
|
||||
private ModelRenderer body;
|
||||
private ModelRenderer arm1;
|
||||
private ModelRenderer arm2;
|
||||
private ModelRenderer arm3;
|
||||
private ModelRenderer arm4;
|
||||
private ModelRenderer top;
|
||||
|
||||
public ModelMachine() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
public ModelMachine() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
base = new ModelRenderer(this, 0, 18);
|
||||
base.addBox(0.0f, 0.0f, 0.0f, 16, 4, 16);
|
||||
base.setRotationPoint(-8.0f, 20.0f, -8.0f);
|
||||
base.setTextureSize(64, 64);
|
||||
base.mirror = true;
|
||||
setRotation(base, 0.0f, 0.0f, 0.0f);
|
||||
base = new ModelRenderer(this, 0, 18);
|
||||
base.addBox(0.0f, 0.0f, 0.0f, 16, 4, 16);
|
||||
base.setRotationPoint(-8.0f, 20.0f, -8.0f);
|
||||
base.setTextureSize(64, 64);
|
||||
base.mirror = true;
|
||||
setRotation(base, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
body = new ModelRenderer(this, 0, 26);
|
||||
body.addBox(0.0f, 0.0f, 0.0f, 12, 7, 12);
|
||||
body.setRotationPoint(-6.0f, 13.0f, -6.0f);
|
||||
body.setTextureSize(64, 64);
|
||||
body.mirror = true;
|
||||
setRotation(body, 0.0f, 0.0f, 0.0f);
|
||||
body = new ModelRenderer(this, 0, 26);
|
||||
body.addBox(0.0f, 0.0f, 0.0f, 12, 7, 12);
|
||||
body.setRotationPoint(-6.0f, 13.0f, -6.0f);
|
||||
body.setTextureSize(64, 64);
|
||||
body.mirror = true;
|
||||
setRotation(body, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
arm1 = new ModelRenderer(this, 0, 0);
|
||||
arm1.addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
|
||||
arm1.setRotationPoint(5.0f, 8.0f, 5.0f);
|
||||
arm1.setTextureSize(64, 64);
|
||||
arm1.mirror = true;
|
||||
setRotation(arm1, 0.0f, 0.0f, 0.0f);
|
||||
arm1 = new ModelRenderer(this, 0, 0);
|
||||
arm1.addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
|
||||
arm1.setRotationPoint(5.0f, 8.0f, 5.0f);
|
||||
arm1.setTextureSize(64, 64);
|
||||
arm1.mirror = true;
|
||||
setRotation(arm1, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
arm2 = new ModelRenderer(this, 0, 0);
|
||||
arm2.addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
|
||||
arm2.setRotationPoint(-5.0f, 8.0f, 5.0f);
|
||||
arm2.setTextureSize(64, 64);
|
||||
arm2.mirror = true;
|
||||
setRotation(arm2, 0.0f, -1.57075f, 0.0f);
|
||||
arm2 = new ModelRenderer(this, 0, 0);
|
||||
arm2.addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
|
||||
arm2.setRotationPoint(-5.0f, 8.0f, 5.0f);
|
||||
arm2.setTextureSize(64, 64);
|
||||
arm2.mirror = true;
|
||||
setRotation(arm2, 0.0f, -1.57075f, 0.0f);
|
||||
|
||||
arm3 = new ModelRenderer(this, 0, 0);
|
||||
arm3.addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
|
||||
arm3.setRotationPoint(-5.0f, 8.0f, -5.0f);
|
||||
arm3.setTextureSize(64, 64);
|
||||
arm3.mirror = true;
|
||||
setRotation(arm3, 0.0f, -3.1415f, 0.0f);
|
||||
arm3 = new ModelRenderer(this, 0, 0);
|
||||
arm3.addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
|
||||
arm3.setRotationPoint(-5.0f, 8.0f, -5.0f);
|
||||
arm3.setTextureSize(64, 64);
|
||||
arm3.mirror = true;
|
||||
setRotation(arm3, 0.0f, -3.1415f, 0.0f);
|
||||
|
||||
arm4 = new ModelRenderer(this, 0, 0);
|
||||
arm4.addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
|
||||
arm4.setRotationPoint(5.0f, 8.0f, -5.0f);
|
||||
arm4.setTextureSize(64, 64);
|
||||
arm4.mirror = true;
|
||||
setRotation(arm4, 0.0f, -4.7122498f, 0.0f);
|
||||
arm4 = new ModelRenderer(this, 0, 0);
|
||||
arm4.addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
|
||||
arm4.setRotationPoint(5.0f, 8.0f, -5.0f);
|
||||
arm4.setTextureSize(64, 64);
|
||||
arm4.mirror = true;
|
||||
setRotation(arm4, 0.0f, -4.7122498f, 0.0f);
|
||||
|
||||
top = new ModelRenderer(this, 0, 0);
|
||||
top.addBox(0.0f, 0.0f, 0.0f, 14, 4, 14);
|
||||
top.setRotationPoint(-7.0f, 9.0f, -7.0f);
|
||||
top.setTextureSize(64, 64);
|
||||
top.mirror = true;
|
||||
setRotation(top, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
top = new ModelRenderer(this, 0, 0);
|
||||
top.addBox(0.0f, 0.0f, 0.0f, 14, 4, 14);
|
||||
top.setRotationPoint(-7.0f, 9.0f, -7.0f);
|
||||
top.setTextureSize(64, 64);
|
||||
top.mirror = true;
|
||||
setRotation(top, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
public void render(float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.render(null, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5);
|
||||
base.render(f5);
|
||||
body.render(f5);
|
||||
arm1.render(f5);
|
||||
arm2.render(f5);
|
||||
arm3.render(f5);
|
||||
arm4.render(f5);
|
||||
top.render(f5);
|
||||
}
|
||||
public void render(float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.render(null, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5);
|
||||
base.render(f5);
|
||||
body.render(f5);
|
||||
arm1.render(f5);
|
||||
arm2.render(f5);
|
||||
arm3.render(f5);
|
||||
arm4.render(f5);
|
||||
top.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
|
||||
}
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
|
||||
}
|
||||
}
|
||||
@@ -18,178 +18,221 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class ModuleMachine implements IInitializable {
|
||||
public static ValidatorIcon IconDye;
|
||||
public static ValidatorIcon IconSequencer;
|
||||
public static ValidatorIcon IconSerum;
|
||||
public static ValidatorIcon IconEnzyme;
|
||||
public static ValidatorIcon IconBacteria;
|
||||
public static ValidatorIcon IconNugget;
|
||||
public static ValidatorIcon IconDye;
|
||||
public static ValidatorIcon IconSequencer;
|
||||
public static ValidatorIcon IconSerum;
|
||||
public static ValidatorIcon IconEnzyme;
|
||||
public static ValidatorIcon IconBacteria;
|
||||
public static ValidatorIcon IconNugget;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
Genetics.packageGenetic = new MachineGroup(Genetics.instance, "machine", "machine", GeneticMachine.values());
|
||||
Genetics.packageGenetic.setCreativeTab(GeneticsCreativeTab.instance);
|
||||
@Override
|
||||
public void preInit() {
|
||||
Genetics.packageGenetic = new MachineGroup(Genetics.instance, "machine", "machine", GeneticMachine.values());
|
||||
Genetics.packageGenetic.setCreativeTab(GeneticsCreativeTab.instance);
|
||||
|
||||
Genetics.packageLabMachine = new MachineGroup(Genetics.instance, "labMachine", "labMachine", LaboratoryMachine.values());
|
||||
Genetics.packageLabMachine.setCreativeTab(GeneticsCreativeTab.instance);
|
||||
Genetics.packageLabMachine =
|
||||
new MachineGroup(Genetics.instance, "labMachine", "labMachine", LaboratoryMachine.values());
|
||||
Genetics.packageLabMachine.setCreativeTab(GeneticsCreativeTab.instance);
|
||||
|
||||
Genetics.packageAdvGenetic = new MachineGroup(Genetics.instance, "advMachine", "advMachine", AdvGeneticMachine.values());
|
||||
Genetics.packageAdvGenetic.setCreativeTab(GeneticsCreativeTab.instance);
|
||||
}
|
||||
Genetics.packageAdvGenetic =
|
||||
new MachineGroup(Genetics.instance, "advMachine", "advMachine", AdvGeneticMachine.values());
|
||||
Genetics.packageAdvGenetic.setCreativeTab(GeneticsCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
ModuleMachine.IconSequencer = new ValidatorIcon(Genetics.instance, "validator/sequencer.0", "validator/sequencer.1");
|
||||
ModuleMachine.IconSerum = new ValidatorIcon(Genetics.instance, "validator/serum.0", "validator/serum.1");
|
||||
ModuleMachine.IconEnzyme = new ValidatorIcon(Genetics.instance, "validator/enzyme.0", "validator/enzyme.1");
|
||||
ModuleMachine.IconDye = new ValidatorIcon(Genetics.instance, "validator/dye.0", "validator/dye.1");
|
||||
ModuleMachine.IconNugget = new ValidatorIcon(Genetics.instance, "validator/nugget.0", "validator/nugget.1");
|
||||
ModuleMachine.IconBacteria = new ValidatorIcon(Genetics.instance, "validator/bacteria.0", "validator/bacteria.1");
|
||||
Incubator.addRecipes();
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
ModuleMachine.IconSequencer =
|
||||
new ValidatorIcon(Genetics.instance, "validator/sequencer.0", "validator/sequencer.1");
|
||||
ModuleMachine.IconSerum = new ValidatorIcon(Genetics.instance, "validator/serum.0", "validator/serum.1");
|
||||
ModuleMachine.IconEnzyme = new ValidatorIcon(Genetics.instance, "validator/enzyme.0", "validator/enzyme.1");
|
||||
ModuleMachine.IconDye = new ValidatorIcon(Genetics.instance, "validator/dye.0", "validator/dye.1");
|
||||
ModuleMachine.IconNugget = new ValidatorIcon(Genetics.instance, "validator/nugget.0", "validator/nugget.1");
|
||||
ModuleMachine.IconBacteria =
|
||||
new ValidatorIcon(Genetics.instance, "validator/bacteria.0", "validator/bacteria.1");
|
||||
Incubator.addRecipes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
Acclimatiser.setupRecipes();
|
||||
Object[] standardCircuit = {Mods.forestry.stack("chipsets", 1, 1)};
|
||||
Object[] advCircuit = {GeneticsItems.IntegratedCircuit.get(1)};
|
||||
String ironGear = OreDictionary.getOres("gearIron").isEmpty() ? "gearIron" : "ingotIron";
|
||||
String goldGear = OreDictionary.getOres("gearGold").isEmpty() ? "gearIron" : "ingotIron";
|
||||
String diamondGear = OreDictionary.getOres("gearDiamond").isEmpty() ? "gearIron" : "ingotIron";
|
||||
@Override
|
||||
public void postInit() {
|
||||
Acclimatiser.setupRecipes();
|
||||
Object[] standardCircuit = {Mods.forestry.stack("chipsets", 1, 1)};
|
||||
Object[] advCircuit = {GeneticsItems.IntegratedCircuit.get(1)};
|
||||
String ironGear = OreDictionary.getOres("gearIron").isEmpty() ? "gearIron" : "ingotIron";
|
||||
String goldGear = OreDictionary.getOres("gearGold").isEmpty() ? "gearIron" : "ingotIron";
|
||||
String diamondGear = OreDictionary.getOres("gearDiamond").isEmpty() ? "gearIron" : "ingotIron";
|
||||
|
||||
for (Object circuit : standardCircuit) {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
LaboratoryMachine.Incubator.get(1),
|
||||
new Object[]{
|
||||
"gFg", "cCc", "aPa",
|
||||
'C', GeneticsItems.LaboratoryCasing.get(1),
|
||||
'F', Blocks.furnace,
|
||||
'c', circuit,
|
||||
'g', Blocks.glass_pane,
|
||||
'P', "gearBronze",
|
||||
'a', ironGear
|
||||
}
|
||||
));
|
||||
for (Object circuit : standardCircuit) {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(LaboratoryMachine.Incubator.get(1), new Object[] {
|
||||
"gFg",
|
||||
"cCc",
|
||||
"aPa",
|
||||
'C',
|
||||
GeneticsItems.LaboratoryCasing.get(1),
|
||||
'F',
|
||||
Blocks.furnace,
|
||||
'c',
|
||||
circuit,
|
||||
'g',
|
||||
Blocks.glass_pane,
|
||||
'P',
|
||||
"gearBronze",
|
||||
'a',
|
||||
ironGear
|
||||
}));
|
||||
|
||||
Item alyzer = null;
|
||||
if (BinnieCore.isApicultureActive()) {
|
||||
alyzer = Mods.forestry.item("beealyzer");
|
||||
} else if (BinnieCore.isArboricultureActive()) {
|
||||
alyzer = Mods.forestry.item("treealyzer");
|
||||
} else if (BinnieCore.isArboricultureActive()) {
|
||||
alyzer = Mods.forestry.item("flutterlyzer");
|
||||
}
|
||||
Item alyzer = null;
|
||||
if (BinnieCore.isApicultureActive()) {
|
||||
alyzer = Mods.forestry.item("beealyzer");
|
||||
} else if (BinnieCore.isArboricultureActive()) {
|
||||
alyzer = Mods.forestry.item("treealyzer");
|
||||
} else if (BinnieCore.isArboricultureActive()) {
|
||||
alyzer = Mods.forestry.item("flutterlyzer");
|
||||
}
|
||||
|
||||
if (alyzer != null) {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
LaboratoryMachine.Analyser.get(1),
|
||||
new Object[]{
|
||||
"gBg", "cCc", "aPa",
|
||||
'C', GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B', alyzer,
|
||||
'c', circuit,
|
||||
'g', Blocks.glass_pane,
|
||||
'P', "gearBronze",
|
||||
'a', GeneticsItems.DNADye.get(1)
|
||||
}
|
||||
));
|
||||
}
|
||||
if (alyzer != null) {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(LaboratoryMachine.Analyser.get(1), new Object[] {
|
||||
"gBg",
|
||||
"cCc",
|
||||
"aPa",
|
||||
'C',
|
||||
GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B',
|
||||
alyzer,
|
||||
'c',
|
||||
circuit,
|
||||
'g',
|
||||
Blocks.glass_pane,
|
||||
'P',
|
||||
"gearBronze",
|
||||
'a',
|
||||
GeneticsItems.DNADye.get(1)
|
||||
}));
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
LaboratoryMachine.Genepool.get(1),
|
||||
new Object[]{
|
||||
"gBg", "cCc", "aPa",
|
||||
'C', GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B', "gearBronze",
|
||||
'c', circuit,
|
||||
'g', Blocks.glass_pane,
|
||||
'P', "gearBronze",
|
||||
'a', Blocks.glass
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
LaboratoryMachine.Acclimatiser.get(1),
|
||||
new Object[]{
|
||||
"gBg", "cCc", "aPa",
|
||||
'C', GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B', Items.lava_bucket,
|
||||
'c', circuit,
|
||||
'g', Blocks.glass_pane,
|
||||
'P', "gearBronze",
|
||||
'a', Items.water_bucket
|
||||
}
|
||||
));
|
||||
}
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(LaboratoryMachine.Genepool.get(1), new Object[] {
|
||||
"gBg",
|
||||
"cCc",
|
||||
"aPa",
|
||||
'C',
|
||||
GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B',
|
||||
"gearBronze",
|
||||
'c',
|
||||
circuit,
|
||||
'g',
|
||||
Blocks.glass_pane,
|
||||
'P',
|
||||
"gearBronze",
|
||||
'a',
|
||||
Blocks.glass
|
||||
}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(LaboratoryMachine.Acclimatiser.get(1), new Object[] {
|
||||
"gBg",
|
||||
"cCc",
|
||||
"aPa",
|
||||
'C',
|
||||
GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B',
|
||||
Items.lava_bucket,
|
||||
'c',
|
||||
circuit,
|
||||
'g',
|
||||
Blocks.glass_pane,
|
||||
'P',
|
||||
"gearBronze",
|
||||
'a',
|
||||
Items.water_bucket
|
||||
}));
|
||||
}
|
||||
|
||||
for (Object circuit : advCircuit) {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticMachine.Isolator.get(1),
|
||||
new Object[]{
|
||||
"gBg", "cCc", "aPa",
|
||||
'C', GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B', goldGear,
|
||||
'c', circuit,
|
||||
'g', Items.gold_nugget,
|
||||
'P', "gearBronze",
|
||||
'a', GeneticsItems.Enzyme.get(1)
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticMachine.Polymeriser.get(1),
|
||||
new Object[]{
|
||||
"gBg", "cCc", "gPg",
|
||||
'C', GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B', ironGear,
|
||||
'c', circuit,
|
||||
'g', Items.gold_nugget,
|
||||
'P', "gearBronze"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticMachine.Sequencer.get(1),
|
||||
new Object[]{
|
||||
"gBg", "cCc", "aPa",
|
||||
'C', GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B', "gearBronze", 'c', circuit,
|
||||
'g', Items.gold_nugget,
|
||||
'P', "gearBronze",
|
||||
'a', GeneticsItems.FluorescentDye.get(1)
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
GeneticMachine.Inoculator.get(1),
|
||||
new Object[]{
|
||||
"gBg", "cCc", "aPa",
|
||||
'C', GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B', diamondGear,
|
||||
'c', circuit,
|
||||
'g', Items.gold_nugget,
|
||||
'P', "gearBronze",
|
||||
'a', Items.emerald
|
||||
}
|
||||
));
|
||||
}
|
||||
for (Object circuit : advCircuit) {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(GeneticMachine.Isolator.get(1), new Object[] {
|
||||
"gBg",
|
||||
"cCc",
|
||||
"aPa",
|
||||
'C',
|
||||
GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B',
|
||||
goldGear,
|
||||
'c',
|
||||
circuit,
|
||||
'g',
|
||||
Items.gold_nugget,
|
||||
'P',
|
||||
"gearBronze",
|
||||
'a',
|
||||
GeneticsItems.Enzyme.get(1)
|
||||
}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(GeneticMachine.Polymeriser.get(1), new Object[] {
|
||||
"gBg",
|
||||
"cCc",
|
||||
"gPg",
|
||||
'C',
|
||||
GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B',
|
||||
ironGear,
|
||||
'c',
|
||||
circuit,
|
||||
'g',
|
||||
Items.gold_nugget,
|
||||
'P',
|
||||
"gearBronze"
|
||||
}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(GeneticMachine.Sequencer.get(1), new Object[] {
|
||||
"gBg",
|
||||
"cCc",
|
||||
"aPa",
|
||||
'C',
|
||||
GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B',
|
||||
"gearBronze",
|
||||
'c',
|
||||
circuit,
|
||||
'g',
|
||||
Items.gold_nugget,
|
||||
'P',
|
||||
"gearBronze",
|
||||
'a',
|
||||
GeneticsItems.FluorescentDye.get(1)
|
||||
}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(GeneticMachine.Inoculator.get(1), new Object[] {
|
||||
"gBg",
|
||||
"cCc",
|
||||
"aPa",
|
||||
'C',
|
||||
GeneticsItems.LaboratoryCasing.get(1),
|
||||
'B',
|
||||
diamondGear,
|
||||
'c',
|
||||
circuit,
|
||||
'g',
|
||||
Items.gold_nugget,
|
||||
'P',
|
||||
"gearBronze",
|
||||
'a',
|
||||
Items.emerald
|
||||
}));
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
AdvGeneticMachine.Splicer.get(1),
|
||||
new Object[]{
|
||||
"gBg", "cCc", "aPa",
|
||||
'C', GeneticsItems.IntegratedCasing.get(1),
|
||||
'B', diamondGear,
|
||||
'c', GeneticsItems.IntegratedCPU.get(1),
|
||||
'g', Items.gold_nugget,
|
||||
'P', "gearBronze",
|
||||
'a', Items.blaze_rod
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
LaboratoryMachine.LabMachine.get(1),
|
||||
new Object[]{
|
||||
"igi", "gCg", "igi",
|
||||
'C', GeneticsItems.LaboratoryCasing.get(1),
|
||||
'i', "ingotIron",
|
||||
'g', Blocks.glass_pane
|
||||
}
|
||||
));
|
||||
}
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(AdvGeneticMachine.Splicer.get(1), new Object[] {
|
||||
"gBg",
|
||||
"cCc",
|
||||
"aPa",
|
||||
'C',
|
||||
GeneticsItems.IntegratedCasing.get(1),
|
||||
'B',
|
||||
diamondGear,
|
||||
'c',
|
||||
GeneticsItems.IntegratedCPU.get(1),
|
||||
'g',
|
||||
Items.gold_nugget,
|
||||
'P',
|
||||
"gearBronze",
|
||||
'a',
|
||||
Items.blaze_rod
|
||||
}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(LaboratoryMachine.LabMachine.get(1), new Object[] {
|
||||
"igi", "gCg", "igi", 'C', GeneticsItems.LaboratoryCasing.get(1), 'i', "ingotIron", 'g', Blocks.glass_pane
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -9,22 +9,22 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public abstract class PackageGeneticBase extends MachinePackage {
|
||||
protected BinnieResource renderTexture;
|
||||
protected int color;
|
||||
protected BinnieResource renderTexture;
|
||||
protected int color;
|
||||
|
||||
protected PackageGeneticBase(String uid, IBinnieTexture renderTexture, int flashColor, boolean powered) {
|
||||
super(uid, powered);
|
||||
this.renderTexture = renderTexture.getTexture();
|
||||
color = flashColor;
|
||||
}
|
||||
protected PackageGeneticBase(String uid, IBinnieTexture renderTexture, int flashColor, boolean powered) {
|
||||
super(uid, powered);
|
||||
this.renderTexture = renderTexture.getTexture();
|
||||
color = flashColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
|
||||
MachineRendererGenetics.instance.renderMachine(machine, color, renderTexture, x, y, z, partialTick);
|
||||
}
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
|
||||
MachineRendererGenetics.instance.renderMachine(machine, color, renderTexture, x, y, z, partialTick);
|
||||
}
|
||||
}
|
||||
@@ -11,180 +11,197 @@ import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Acclimatiser {
|
||||
public static final int[] SLOT_RESERVE = new int[]{0, 1, 2, 3};
|
||||
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;
|
||||
public static final int[] SLOT_RESERVE = new int[] {0, 1, 2, 3};
|
||||
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;
|
||||
|
||||
public static Map<ItemStack, Float> temperatureItems = new HashMap<>();
|
||||
public static Map<ItemStack, Float> humidityItems = new HashMap<>();
|
||||
public static Map<ItemStack, Float> temperatureItems = new HashMap<>();
|
||||
public static Map<ItemStack, Float> humidityItems = new HashMap<>();
|
||||
|
||||
private static List<ToleranceSystem> toleranceSystems = new ArrayList<>();
|
||||
private static List<ToleranceSystem> toleranceSystems = new ArrayList<>();
|
||||
|
||||
private static ToleranceSystem getToleranceSystem(ItemStack stack, ItemStack acclim) {
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
if (root == null) {
|
||||
return null;
|
||||
}
|
||||
private static ToleranceSystem getToleranceSystem(ItemStack stack, ItemStack acclim) {
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
if (root == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (ToleranceSystem system : Acclimatiser.toleranceSystems) {
|
||||
if (root.getUID().equals(system.uid) && system.type.hasEffect(acclim)) {
|
||||
return system;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
for (ToleranceSystem system : Acclimatiser.toleranceSystems) {
|
||||
if (root.getUID().equals(system.uid) && system.type.hasEffect(acclim)) {
|
||||
return system;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addTolerance(String uid, IChromosomeType chromosome, ToleranceType type) {
|
||||
Acclimatiser.toleranceSystems.add(new ToleranceSystem(uid, chromosome, type));
|
||||
}
|
||||
public static void addTolerance(String uid, IChromosomeType chromosome, ToleranceType type) {
|
||||
Acclimatiser.toleranceSystems.add(new ToleranceSystem(uid, chromosome, type));
|
||||
}
|
||||
|
||||
public static float getTemperatureEffect(ItemStack item) {
|
||||
for (ItemStack stack : Acclimatiser.temperatureItems.keySet()) {
|
||||
if (stack.isItemEqual(item)) {
|
||||
return Acclimatiser.temperatureItems.get(stack);
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
public static float getTemperatureEffect(ItemStack item) {
|
||||
for (ItemStack stack : Acclimatiser.temperatureItems.keySet()) {
|
||||
if (stack.isItemEqual(item)) {
|
||||
return Acclimatiser.temperatureItems.get(stack);
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static float getHumidityEffect(ItemStack item) {
|
||||
for (ItemStack stack : Acclimatiser.humidityItems.keySet()) {
|
||||
if (stack.isItemEqual(item)) {
|
||||
return Acclimatiser.humidityItems.get(stack);
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
public static float getHumidityEffect(ItemStack item) {
|
||||
for (ItemStack stack : Acclimatiser.humidityItems.keySet()) {
|
||||
if (stack.isItemEqual(item)) {
|
||||
return Acclimatiser.humidityItems.get(stack);
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static void addTemperatureItem(ItemStack itemStack, float amount) {
|
||||
if (itemStack == null) {
|
||||
return;
|
||||
}
|
||||
Acclimatiser.temperatureItems.put(itemStack, amount);
|
||||
}
|
||||
public static void addTemperatureItem(ItemStack itemStack, float amount) {
|
||||
if (itemStack == null) {
|
||||
return;
|
||||
}
|
||||
Acclimatiser.temperatureItems.put(itemStack, amount);
|
||||
}
|
||||
|
||||
public static void addHumidityItem(ItemStack itemStack, float amount) {
|
||||
if (itemStack == null) {
|
||||
return;
|
||||
}
|
||||
Acclimatiser.humidityItems.put(itemStack, amount);
|
||||
}
|
||||
public static void addHumidityItem(ItemStack itemStack, float amount) {
|
||||
if (itemStack == null) {
|
||||
return;
|
||||
}
|
||||
Acclimatiser.humidityItems.put(itemStack, amount);
|
||||
}
|
||||
|
||||
public static void setupRecipes() {
|
||||
if (BinnieCore.isApicultureActive()) {
|
||||
addTolerance(Binnie.Genetics.getBeeRoot().getUID(), EnumBeeChromosome.HUMIDITY_TOLERANCE, ToleranceType.Humidity);
|
||||
addTolerance(Binnie.Genetics.getBeeRoot().getUID(), EnumBeeChromosome.TEMPERATURE_TOLERANCE, ToleranceType.Temperature);
|
||||
}
|
||||
public static void setupRecipes() {
|
||||
if (BinnieCore.isApicultureActive()) {
|
||||
addTolerance(
|
||||
Binnie.Genetics.getBeeRoot().getUID(),
|
||||
EnumBeeChromosome.HUMIDITY_TOLERANCE,
|
||||
ToleranceType.Humidity);
|
||||
addTolerance(
|
||||
Binnie.Genetics.getBeeRoot().getUID(),
|
||||
EnumBeeChromosome.TEMPERATURE_TOLERANCE,
|
||||
ToleranceType.Temperature);
|
||||
}
|
||||
|
||||
if (BinnieCore.isLepidopteryActive()) {
|
||||
addTolerance(Binnie.Genetics.getButterflyRoot().getUID(), EnumButterflyChromosome.HUMIDITY_TOLERANCE, ToleranceType.Humidity);
|
||||
addTolerance(Binnie.Genetics.getButterflyRoot().getUID(), EnumButterflyChromosome.TEMPERATURE_TOLERANCE, ToleranceType.Temperature);
|
||||
}
|
||||
if (BinnieCore.isLepidopteryActive()) {
|
||||
addTolerance(
|
||||
Binnie.Genetics.getButterflyRoot().getUID(),
|
||||
EnumButterflyChromosome.HUMIDITY_TOLERANCE,
|
||||
ToleranceType.Humidity);
|
||||
addTolerance(
|
||||
Binnie.Genetics.getButterflyRoot().getUID(),
|
||||
EnumButterflyChromosome.TEMPERATURE_TOLERANCE,
|
||||
ToleranceType.Temperature);
|
||||
}
|
||||
|
||||
if (BinnieCore.isBotanyActive()) {
|
||||
addTolerance(Binnie.Genetics.getFlowerRoot().getUID(), EnumFlowerChromosome.HUMIDITY_TOLERANCE, ToleranceType.Humidity);
|
||||
addTolerance(Binnie.Genetics.getFlowerRoot().getUID(), EnumFlowerChromosome.TEMPERATURE_TOLERANCE, ToleranceType.Temperature);
|
||||
addTolerance(Binnie.Genetics.getFlowerRoot().getUID(), EnumFlowerChromosome.PH_TOLERANCE, ToleranceType.PH);
|
||||
}
|
||||
if (BinnieCore.isBotanyActive()) {
|
||||
addTolerance(
|
||||
Binnie.Genetics.getFlowerRoot().getUID(),
|
||||
EnumFlowerChromosome.HUMIDITY_TOLERANCE,
|
||||
ToleranceType.Humidity);
|
||||
addTolerance(
|
||||
Binnie.Genetics.getFlowerRoot().getUID(),
|
||||
EnumFlowerChromosome.TEMPERATURE_TOLERANCE,
|
||||
ToleranceType.Temperature);
|
||||
addTolerance(Binnie.Genetics.getFlowerRoot().getUID(), EnumFlowerChromosome.PH_TOLERANCE, ToleranceType.PH);
|
||||
}
|
||||
|
||||
addTemperatureItem(new ItemStack(Items.blaze_powder), 0.5f);
|
||||
addTemperatureItem(new ItemStack(Items.blaze_rod), 0.75f);
|
||||
addTemperatureItem(new ItemStack(Items.lava_bucket), 0.75f);
|
||||
addTemperatureItem(new ItemStack(Items.snowball), -0.15f);
|
||||
addTemperatureItem(new ItemStack(Blocks.ice), -0.75f);
|
||||
addHumidityItem(new ItemStack(Items.water_bucket), 0.75f);
|
||||
addHumidityItem(new ItemStack(Blocks.sand), -0.15f);
|
||||
addTemperatureItem(Mods.forestry.stack("canLava"), 0.75f);
|
||||
addTemperatureItem(Mods.forestry.stack("refractoryLava"), 0.75f);
|
||||
addHumidityItem(Mods.forestry.stack("canWater"), 0.75f);
|
||||
addHumidityItem(Mods.forestry.stack("refractoryWater"), 0.75f);
|
||||
addHumidityItem(Mods.forestry.stack("waxCapsuleWater"), 0.75f);
|
||||
}
|
||||
addTemperatureItem(new ItemStack(Items.blaze_powder), 0.5f);
|
||||
addTemperatureItem(new ItemStack(Items.blaze_rod), 0.75f);
|
||||
addTemperatureItem(new ItemStack(Items.lava_bucket), 0.75f);
|
||||
addTemperatureItem(new ItemStack(Items.snowball), -0.15f);
|
||||
addTemperatureItem(new ItemStack(Blocks.ice), -0.75f);
|
||||
addHumidityItem(new ItemStack(Items.water_bucket), 0.75f);
|
||||
addHumidityItem(new ItemStack(Blocks.sand), -0.15f);
|
||||
addTemperatureItem(Mods.forestry.stack("canLava"), 0.75f);
|
||||
addTemperatureItem(Mods.forestry.stack("refractoryLava"), 0.75f);
|
||||
addHumidityItem(Mods.forestry.stack("canWater"), 0.75f);
|
||||
addHumidityItem(Mods.forestry.stack("refractoryWater"), 0.75f);
|
||||
addHumidityItem(Mods.forestry.stack("waxCapsuleWater"), 0.75f);
|
||||
}
|
||||
|
||||
public static boolean canAcclimatise(ItemStack stack, List<ItemStack> acclimatisers) {
|
||||
if (stack == null || acclimatisers.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
public static boolean canAcclimatise(ItemStack stack, List<ItemStack> acclimatisers) {
|
||||
if (stack == null || acclimatisers.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (ItemStack acclim : acclimatisers) {
|
||||
if (canAcclimatise(stack, acclim)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
for (ItemStack acclim : acclimatisers) {
|
||||
if (canAcclimatise(stack, acclim)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean canAcclimatise(ItemStack stack, ItemStack acclim) {
|
||||
ToleranceSystem system = getToleranceSystem(stack, acclim);
|
||||
return system != null && system.canAlter(stack, acclim);
|
||||
}
|
||||
public static boolean canAcclimatise(ItemStack stack, ItemStack acclim) {
|
||||
ToleranceSystem system = getToleranceSystem(stack, acclim);
|
||||
return system != null && system.canAlter(stack, acclim);
|
||||
}
|
||||
|
||||
public static ItemStack acclimatise(ItemStack stack, ItemStack acc) {
|
||||
ToleranceSystem system = getToleranceSystem(stack, acc);
|
||||
return system.alter(stack, acc);
|
||||
}
|
||||
public static ItemStack acclimatise(ItemStack stack, ItemStack acc) {
|
||||
ToleranceSystem system = getToleranceSystem(stack, acc);
|
||||
return system.alter(stack, acc);
|
||||
}
|
||||
|
||||
public static Tolerance alterTolerance(Tolerance tol, float effect) {
|
||||
int[] is = tol.getBounds();
|
||||
int[] range;
|
||||
if (effect < 0.0f) {
|
||||
range = new int[]{is[0] - 1, is[1]};
|
||||
} else {
|
||||
range = new int[]{is[0], is[1] + 1};
|
||||
}
|
||||
public static Tolerance alterTolerance(Tolerance tol, float effect) {
|
||||
int[] is = tol.getBounds();
|
||||
int[] range;
|
||||
if (effect < 0.0f) {
|
||||
range = new int[] {is[0] - 1, is[1]};
|
||||
} else {
|
||||
range = new int[] {is[0], is[1] + 1};
|
||||
}
|
||||
|
||||
if (range[0] < -5) {
|
||||
range[0] = -5;
|
||||
}
|
||||
if (range[1] > 5) {
|
||||
range[1] = 5;
|
||||
}
|
||||
if (range[0] < -5) {
|
||||
range[0] = -5;
|
||||
}
|
||||
if (range[1] > 5) {
|
||||
range[1] = 5;
|
||||
}
|
||||
|
||||
EnumTolerance[] up = {
|
||||
EnumTolerance.NONE,
|
||||
EnumTolerance.UP_1,
|
||||
EnumTolerance.UP_2,
|
||||
EnumTolerance.UP_3,
|
||||
EnumTolerance.UP_4,
|
||||
EnumTolerance.UP_5
|
||||
};
|
||||
EnumTolerance[] down = {
|
||||
EnumTolerance.NONE,
|
||||
EnumTolerance.DOWN_1,
|
||||
EnumTolerance.DOWN_2,
|
||||
EnumTolerance.DOWN_3,
|
||||
EnumTolerance.DOWN_4,
|
||||
EnumTolerance.DOWN_5
|
||||
};
|
||||
EnumTolerance[] both = {
|
||||
EnumTolerance.NONE,
|
||||
EnumTolerance.BOTH_1,
|
||||
EnumTolerance.BOTH_2,
|
||||
EnumTolerance.BOTH_3,
|
||||
EnumTolerance.BOTH_4,
|
||||
EnumTolerance.BOTH_5
|
||||
};
|
||||
EnumTolerance[] up = {
|
||||
EnumTolerance.NONE,
|
||||
EnumTolerance.UP_1,
|
||||
EnumTolerance.UP_2,
|
||||
EnumTolerance.UP_3,
|
||||
EnumTolerance.UP_4,
|
||||
EnumTolerance.UP_5
|
||||
};
|
||||
EnumTolerance[] down = {
|
||||
EnumTolerance.NONE,
|
||||
EnumTolerance.DOWN_1,
|
||||
EnumTolerance.DOWN_2,
|
||||
EnumTolerance.DOWN_3,
|
||||
EnumTolerance.DOWN_4,
|
||||
EnumTolerance.DOWN_5
|
||||
};
|
||||
EnumTolerance[] both = {
|
||||
EnumTolerance.NONE,
|
||||
EnumTolerance.BOTH_1,
|
||||
EnumTolerance.BOTH_2,
|
||||
EnumTolerance.BOTH_3,
|
||||
EnumTolerance.BOTH_4,
|
||||
EnumTolerance.BOTH_5
|
||||
};
|
||||
|
||||
if (range[0] == 0) {
|
||||
return Tolerance.get(up[range[1]]);
|
||||
}
|
||||
if (range[1] == 0) {
|
||||
return Tolerance.get(down[-range[0]]);
|
||||
}
|
||||
if (range[0] == 0) {
|
||||
return Tolerance.get(up[range[1]]);
|
||||
}
|
||||
if (range[1] == 0) {
|
||||
return Tolerance.get(down[-range[0]]);
|
||||
}
|
||||
|
||||
int avg = (int) ((-range[0] + range[1]) / 2.0f + 0.6f);
|
||||
return Tolerance.get(both[avg]);
|
||||
}
|
||||
int avg = (int) ((-range[0] + range[1]) / 2.0f + 0.6f);
|
||||
return Tolerance.get(both[avg]);
|
||||
}
|
||||
}
|
||||
+62
-63
@@ -4,78 +4,77 @@ import binnie.core.machines.IMachine;
|
||||
import binnie.core.machines.power.ComponentProcessIndefinate;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.util.I18N;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AcclimatiserComponentLogic extends ComponentProcessIndefinate {
|
||||
public AcclimatiserComponentLogic(IMachine machine) {
|
||||
super(machine, Acclimatiser.ENERGY_PER_TICK);
|
||||
}
|
||||
public AcclimatiserComponentLogic(IMachine machine) {
|
||||
super(machine, Acclimatiser.ENERGY_PER_TICK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().getStack(Acclimatiser.SLOT_TARGET) == null) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.acclimatiser.error.noIndividual"),
|
||||
Acclimatiser.SLOT_TARGET
|
||||
);
|
||||
}
|
||||
if (getUtil().getNonNullStacks(Acclimatiser.SLOT_ACCLIMATISER).isEmpty()) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.acclimatiser.error.noAcclimatizingItems"),
|
||||
Acclimatiser.SLOT_ACCLIMATISER
|
||||
);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().getStack(Acclimatiser.SLOT_TARGET) == null) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.acclimatiser.error.noIndividual"), Acclimatiser.SLOT_TARGET);
|
||||
}
|
||||
if (getUtil().getNonNullStacks(Acclimatiser.SLOT_ACCLIMATISER).isEmpty()) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.acclimatiser.error.noAcclimatizingItems"),
|
||||
Acclimatiser.SLOT_ACCLIMATISER);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!Acclimatiser.canAcclimatise(getUtil().getStack(Acclimatiser.SLOT_TARGET), getUtil().getNonNullStacks(Acclimatiser.SLOT_ACCLIMATISER))) {
|
||||
return new ErrorState.InvalidItem(
|
||||
I18N.localise("genetics.machine.acclimatiser.error.invalidAcclimatizingItems"),
|
||||
Acclimatiser.SLOT_TARGET
|
||||
);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!Acclimatiser.canAcclimatise(
|
||||
getUtil().getStack(Acclimatiser.SLOT_TARGET),
|
||||
getUtil().getNonNullStacks(Acclimatiser.SLOT_ACCLIMATISER))) {
|
||||
return new ErrorState.InvalidItem(
|
||||
I18N.localise("genetics.machine.acclimatiser.error.invalidAcclimatizingItems"),
|
||||
Acclimatiser.SLOT_TARGET);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean inProgress() {
|
||||
return canWork() == null;
|
||||
}
|
||||
@Override
|
||||
protected boolean inProgress() {
|
||||
return canWork() == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
super.onTickTask();
|
||||
if (getUtil().getRandom().nextInt(100) == 0) {
|
||||
attemptAcclimatisation();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
super.onTickTask();
|
||||
if (getUtil().getRandom().nextInt(100) == 0) {
|
||||
attemptAcclimatisation();
|
||||
}
|
||||
}
|
||||
|
||||
protected void attemptAcclimatisation() {
|
||||
List<ItemStack> acclms = new ArrayList<>();
|
||||
for (ItemStack s : getUtil().getNonNullStacks(Acclimatiser.SLOT_ACCLIMATISER)) {
|
||||
if (Acclimatiser.canAcclimatise(getUtil().getStack(Acclimatiser.SLOT_TARGET), s)) {
|
||||
acclms.add(s);
|
||||
}
|
||||
}
|
||||
protected void attemptAcclimatisation() {
|
||||
List<ItemStack> acclms = new ArrayList<>();
|
||||
for (ItemStack s : getUtil().getNonNullStacks(Acclimatiser.SLOT_ACCLIMATISER)) {
|
||||
if (Acclimatiser.canAcclimatise(getUtil().getStack(Acclimatiser.SLOT_TARGET), s)) {
|
||||
acclms.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack acc = acclms.get(getUtil().getRandom().nextInt(acclms.size()));
|
||||
ItemStack acclimed = Acclimatiser.acclimatise(getUtil().getStack(Acclimatiser.SLOT_TARGET), acc);
|
||||
if (acclimed == null) {
|
||||
return;
|
||||
}
|
||||
ItemStack acc = acclms.get(getUtil().getRandom().nextInt(acclms.size()));
|
||||
ItemStack acclimed = Acclimatiser.acclimatise(getUtil().getStack(Acclimatiser.SLOT_TARGET), acc);
|
||||
if (acclimed == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
getUtil().setStack(Acclimatiser.SLOT_TARGET, acclimed);
|
||||
boolean removed = false;
|
||||
for (int i : Acclimatiser.SLOT_ACCLIMATISER) {
|
||||
if (!removed && getUtil().getStack(i) != null && getUtil().getStack(i).isItemEqual(acc)) {
|
||||
getUtil().decreaseStack(i, 1);
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
getUtil().setStack(Acclimatiser.SLOT_TARGET, acclimed);
|
||||
boolean removed = false;
|
||||
for (int i : Acclimatiser.SLOT_ACCLIMATISER) {
|
||||
if (!removed
|
||||
&& getUtil().getStack(i) != null
|
||||
&& getUtil().getStack(i).isItemEqual(acc)) {
|
||||
getUtil().decreaseStack(i, 1);
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
-16
@@ -5,22 +5,22 @@ import binnie.core.util.I18N;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AcclimatiserItemSlotValidator extends SlotValidator {
|
||||
public AcclimatiserItemSlotValidator() {
|
||||
super(null);
|
||||
}
|
||||
public AcclimatiserItemSlotValidator() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack stack) {
|
||||
for (ToleranceType type : ToleranceType.values()) {
|
||||
if (type.hasEffect(stack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(ItemStack stack) {
|
||||
for (ToleranceType type : ToleranceType.values()) {
|
||||
if (type.hasEffect(stack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.acclimatiser.acclimatizingItems");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.acclimatiser.acclimatizingItems");
|
||||
}
|
||||
}
|
||||
@@ -16,48 +16,50 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class AcclimatiserPackage extends PackageGeneticBase implements IMachineInformation {
|
||||
public AcclimatiserPackage() {
|
||||
super("acclimatiser", GeneticsTexture.Acclimatiser, 0x966a49, true);
|
||||
}
|
||||
public AcclimatiserPackage() {
|
||||
super("acclimatiser", GeneticsTexture.Acclimatiser, 0x966a49, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Acclimatiser);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
InventorySlot processSlot = inventory.addSlot(Acclimatiser.SLOT_TARGET, "process");
|
||||
processSlot.setValidator(new SlotValidator.Individual());
|
||||
processSlot.setReadOnly();
|
||||
processSlot.forbidExtraction();
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Acclimatiser);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
InventorySlot processSlot = inventory.addSlot(Acclimatiser.SLOT_TARGET, "process");
|
||||
processSlot.setValidator(new SlotValidator.Individual());
|
||||
processSlot.setReadOnly();
|
||||
processSlot.forbidExtraction();
|
||||
|
||||
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.SLOT_RESERVE, "input")) {
|
||||
slot.forbidExtraction();
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
}
|
||||
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.SLOT_RESERVE, "input")) {
|
||||
slot.forbidExtraction();
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
}
|
||||
|
||||
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.SLOT_DONE, "output")) {
|
||||
slot.setReadOnly();
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
}
|
||||
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.SLOT_DONE, "output")) {
|
||||
slot.setReadOnly();
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
}
|
||||
|
||||
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.SLOT_ACCLIMATISER, "acclimatiser")) {
|
||||
slot.setValidator(new AcclimatiserItemSlotValidator());
|
||||
}
|
||||
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.SLOT_ACCLIMATISER, "acclimatiser")) {
|
||||
slot.setValidator(new AcclimatiserItemSlotValidator());
|
||||
}
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Acclimatiser.SLOT_RESERVE, Acclimatiser.SLOT_TARGET, 1);
|
||||
transfer.addStorage(Acclimatiser.SLOT_TARGET, Acclimatiser.SLOT_DONE, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return !Acclimatiser.canAcclimatise(stack, machine.getMachineUtil().getNonNullStacks(Acclimatiser.SLOT_ACCLIMATISER));
|
||||
}
|
||||
});
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Acclimatiser.SLOT_RESERVE, Acclimatiser.SLOT_TARGET, 1);
|
||||
transfer.addStorage(
|
||||
Acclimatiser.SLOT_TARGET, Acclimatiser.SLOT_DONE, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return !Acclimatiser.canAcclimatise(
|
||||
stack, machine.getMachineUtil().getNonNullStacks(Acclimatiser.SLOT_ACCLIMATISER));
|
||||
}
|
||||
});
|
||||
|
||||
new ComponentPowerReceptor(machine, 5000);
|
||||
new AcclimatiserComponentLogic(machine);
|
||||
}
|
||||
new ComponentPowerReceptor(machine, 5000);
|
||||
new AcclimatiserComponentLogic(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
@@ -9,49 +9,47 @@ import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import java.util.Random;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ToleranceSystem {
|
||||
public String uid;
|
||||
public IChromosomeType chromosomeOrdinal;
|
||||
public ToleranceType type;
|
||||
public String uid;
|
||||
public IChromosomeType chromosomeOrdinal;
|
||||
public ToleranceType type;
|
||||
|
||||
ToleranceSystem(String uid, IChromosomeType chromosomeOrdinal, ToleranceType type) {
|
||||
this.uid = uid;
|
||||
this.chromosomeOrdinal = chromosomeOrdinal;
|
||||
this.type = type;
|
||||
}
|
||||
ToleranceSystem(String uid, IChromosomeType chromosomeOrdinal, ToleranceType type) {
|
||||
this.uid = uid;
|
||||
this.chromosomeOrdinal = chromosomeOrdinal;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean canAlter(ItemStack stack, ItemStack acclim) {
|
||||
IIndividual member = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
IGenome genome = member.getGenome();
|
||||
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);
|
||||
}
|
||||
public boolean canAlter(ItemStack stack, ItemStack acclim) {
|
||||
IIndividual member = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
IGenome genome = member.getGenome();
|
||||
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);
|
||||
}
|
||||
|
||||
public ItemStack alter(ItemStack stack, ItemStack acc) {
|
||||
Random rand = new Random();
|
||||
float effect = type.getEffect(acc);
|
||||
if (rand.nextFloat() > Math.abs(effect)) {
|
||||
return stack;
|
||||
}
|
||||
public ItemStack alter(ItemStack stack, ItemStack acc) {
|
||||
Random rand = new Random();
|
||||
float effect = type.getEffect(acc);
|
||||
if (rand.nextFloat() > Math.abs(effect)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
IIndividual member = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
IGenome genome = member.getGenome();
|
||||
IAlleleTolerance tolAllele = (IAlleleTolerance) genome.getActiveAllele(chromosomeOrdinal);
|
||||
Tolerance tol = Tolerance.get(tolAllele.getValue());
|
||||
Tolerance newTol = Acclimatiser.alterTolerance(tol, effect);
|
||||
if (rand.nextFloat() > 1.0f / (-newTol.getBounds()[0] + newTol.getBounds()[1])) {
|
||||
return stack;
|
||||
}
|
||||
IIndividual member = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
IGenome genome = member.getGenome();
|
||||
IAlleleTolerance tolAllele = (IAlleleTolerance) genome.getActiveAllele(chromosomeOrdinal);
|
||||
Tolerance tol = Tolerance.get(tolAllele.getValue());
|
||||
Tolerance newTol = Acclimatiser.alterTolerance(tol, effect);
|
||||
if (rand.nextFloat() > 1.0f / (-newTol.getBounds()[0] + newTol.getBounds()[1])) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
Inoculator.setGene(new Gene(newTol.getAllele(), chromosomeOrdinal, root), stack, rand.nextInt(2));
|
||||
return stack;
|
||||
}
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
Inoculator.setGene(new Gene(newTol.getAllele(), chromosomeOrdinal, root), stack, rand.nextInt(2));
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -4,30 +4,30 @@ import binnie.botany.gardening.Gardening;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public enum ToleranceType {
|
||||
Temperature,
|
||||
Humidity,
|
||||
PH;
|
||||
Temperature,
|
||||
Humidity,
|
||||
PH;
|
||||
|
||||
public float getEffect(ItemStack stack) {
|
||||
switch (this) {
|
||||
case Temperature:
|
||||
return Acclimatiser.getTemperatureEffect(stack);
|
||||
public float getEffect(ItemStack stack) {
|
||||
switch (this) {
|
||||
case Temperature:
|
||||
return Acclimatiser.getTemperatureEffect(stack);
|
||||
|
||||
case Humidity:
|
||||
return Acclimatiser.getHumidityEffect(stack);
|
||||
case Humidity:
|
||||
return Acclimatiser.getHumidityEffect(stack);
|
||||
|
||||
case PH:
|
||||
if (Gardening.isAcidFertiliser(stack)) {
|
||||
return -0.5f * Gardening.getFertiliserStrength(stack);
|
||||
}
|
||||
if (Gardening.isAlkalineFertiliser(stack)) {
|
||||
return 0.5f * Gardening.getFertiliserStrength(stack);
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
case PH:
|
||||
if (Gardening.isAcidFertiliser(stack)) {
|
||||
return -0.5f * Gardening.getFertiliserStrength(stack);
|
||||
}
|
||||
if (Gardening.isAlkalineFertiliser(stack)) {
|
||||
return 0.5f * Gardening.getFertiliserStrength(stack);
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public boolean hasEffect(ItemStack stack) {
|
||||
return getEffect(stack) != 0.0f;
|
||||
}
|
||||
public boolean hasEffect(ItemStack stack) {
|
||||
return getEffect(stack) != 0.0f;
|
||||
}
|
||||
}
|
||||
@@ -9,49 +9,48 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class Analyser {
|
||||
public static final int[] SLOT_RESERVE = new int[]{0, 1, 2, 3, 4, 5};
|
||||
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 final int[] SLOT_RESERVE = new int[] {0, 1, 2, 3, 4, 5};
|
||||
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);
|
||||
return ind != null
|
||||
|| stack.getItem() instanceof IItemAnalysable
|
||||
|| Binnie.Genetics.getConversion(stack) != null;
|
||||
}
|
||||
public static boolean isAnalysable(ItemStack stack) {
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
return ind != null
|
||||
|| stack.getItem() instanceof IItemAnalysable
|
||||
|| Binnie.Genetics.getConversion(stack) != null;
|
||||
}
|
||||
|
||||
public static boolean isAnalysed(ItemStack stack) {
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
if (ind != null) {
|
||||
return ind.isAnalyzed();
|
||||
}
|
||||
return stack.getItem() instanceof IItemAnalysable
|
||||
&& ((IItemAnalysable) stack.getItem()).isAnalysed(stack);
|
||||
}
|
||||
public static boolean isAnalysed(ItemStack stack) {
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
if (ind != null) {
|
||||
return ind.isAnalyzed();
|
||||
}
|
||||
return stack.getItem() instanceof IItemAnalysable && ((IItemAnalysable) stack.getItem()).isAnalysed(stack);
|
||||
}
|
||||
|
||||
public static ItemStack analyse(ItemStack stack) {
|
||||
ItemStack conv = Binnie.Genetics.getConversionStack(stack);
|
||||
if (conv != null) {
|
||||
stack = conv;
|
||||
}
|
||||
public static ItemStack analyse(ItemStack stack) {
|
||||
ItemStack conv = Binnie.Genetics.getConversionStack(stack);
|
||||
if (conv != null) {
|
||||
stack = conv;
|
||||
}
|
||||
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
if (root != null) {
|
||||
IIndividual ind = root.getMember(stack);
|
||||
ind.analyze();
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
ind.writeToNBT(nbttagcompound);
|
||||
stack.setTagCompound(nbttagcompound);
|
||||
return stack;
|
||||
}
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
if (root != null) {
|
||||
IIndividual ind = root.getMember(stack);
|
||||
ind.analyze();
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
ind.writeToNBT(nbttagcompound);
|
||||
stack.setTagCompound(nbttagcompound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (stack.getItem() instanceof IItemAnalysable) {
|
||||
return ((IItemAnalysable) stack.getItem()).analyse(stack);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
if (stack.getItem() instanceof IItemAnalysable) {
|
||||
return ((IItemAnalysable) stack.getItem()).analyse(stack);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import binnie.core.machines.component.IRender;
|
||||
import binnie.core.machines.network.INetwork;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -17,119 +18,117 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Random;
|
||||
public class AnalyserComponentFX extends MachineComponent
|
||||
implements IRender.RandomDisplayTick, IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync {
|
||||
private EntityItem dummyEntityItem;
|
||||
|
||||
public class AnalyserComponentFX extends MachineComponent implements
|
||||
IRender.RandomDisplayTick,
|
||||
IRender.DisplayTick,
|
||||
IRender.Render,
|
||||
INetwork.TilePacketSync {
|
||||
private EntityItem dummyEntityItem;
|
||||
public AnalyserComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
dummyEntityItem = new EntityItem(null);
|
||||
}
|
||||
|
||||
public AnalyserComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
dummyEntityItem = new EntityItem(null);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
// ignored
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (rand.nextFloat() < 1.0f && getUtil().getProcess().isInProgress()) {
|
||||
BinnieCore.proxy
|
||||
.getMinecraftInstance()
|
||||
.effectRenderer
|
||||
.addEffect(new EntityFX(world, x + 0.5, y + 1.3 + rand.nextDouble() * 0.2, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = rand.nextDouble() * 2.0 * 3.1415;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (rand.nextFloat() < 1.0f && getUtil().getProcess().isInProgress()) {
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1.3 + rand.nextDouble() * 0.2, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = rand.nextDouble() * 2.0 * 3.1415;
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.05 * (rand.nextDouble() - 0.5);
|
||||
motionZ = 0.05 * (rand.nextDouble() - 0.5);
|
||||
motionY = 0.0;
|
||||
particleMaxAge = 25;
|
||||
particleGravity = 0.05f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.6f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.05 * (rand.nextDouble() - 0.5);
|
||||
motionZ = 0.05 * (rand.nextDouble() - 0.5);
|
||||
motionY = 0.0;
|
||||
particleMaxAge = 25;
|
||||
particleGravity = 0.05f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.6f, 0.0f, 1.0f);
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
}
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderInWorld(RenderItem renderItem, double x, double y, double z) {
|
||||
if (!getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderInWorld(RenderItem renderItem, double x, double y, double z) {
|
||||
if (!getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = getUtil().getStack(Analyser.SLOT_TARGET);
|
||||
dummyEntityItem.worldObj = getMachine().getWorld();
|
||||
dummyEntityItem.setEntityItemStack(stack);
|
||||
EntityItem dummyEntityItem = this.dummyEntityItem;
|
||||
dummyEntityItem.age++;
|
||||
this.dummyEntityItem.hoverStart = 0.0f;
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack stack = getUtil().getStack(Analyser.SLOT_TARGET);
|
||||
dummyEntityItem.worldObj = getMachine().getWorld();
|
||||
dummyEntityItem.setEntityItemStack(stack);
|
||||
EntityItem dummyEntityItem = this.dummyEntityItem;
|
||||
dummyEntityItem.age++;
|
||||
this.dummyEntityItem.hoverStart = 0.0f;
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
double dx = x + 0.5 - player.lastTickPosX;
|
||||
double dz = z + 0.5 - player.lastTickPosZ;
|
||||
double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glTranslatef(0.0f, -0.2f, 0.0f);
|
||||
renderItem.doRender(this.dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
double dx = x + 0.5 - player.lastTickPosX;
|
||||
double dz = z + 0.5 - player.lastTickPosZ;
|
||||
double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glTranslatef(0.0f, -0.2f, 0.0f);
|
||||
renderItem.doRender(this.dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public void syncToNBT(NBTTagCompound nbt) {
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
ItemStack stack = getUtil().getStack(Analyser.SLOT_TARGET);
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToNBT(NBTTagCompound nbt) {
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
ItemStack stack = getUtil().getStack(Analyser.SLOT_TARGET);
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
stack.writeToNBT(item);
|
||||
nbt.setTag("item", item);
|
||||
}
|
||||
|
||||
stack.writeToNBT(item);
|
||||
nbt.setTag("item", item);
|
||||
}
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
if (nbt.hasKey("item")) {
|
||||
getUtil().setStack(Analyser.SLOT_TARGET, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
|
||||
} else {
|
||||
getUtil().setStack(Analyser.SLOT_TARGET, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
if (nbt.hasKey("item")) {
|
||||
getUtil().setStack(Analyser.SLOT_TARGET, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
|
||||
} else {
|
||||
getUtil().setStack(Analyser.SLOT_TARGET, null);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onInventoryUpdate() {
|
||||
if (!getUtil().isServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryUpdate() {
|
||||
if (!getUtil().isServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
IMachine machine = getMachine();
|
||||
TileEntity tile = machine.getTileEntity();
|
||||
machine.getWorld().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
IMachine machine = getMachine();
|
||||
TileEntity tile = machine.getTileEntity();
|
||||
machine.getWorld().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
}
|
||||
@@ -8,54 +8,49 @@ import binnie.core.util.I18N;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AnalyserComponentLogic extends ComponentProcessSetCost implements IProcess {
|
||||
public AnalyserComponentLogic(Machine machine) {
|
||||
super(machine, Analyser.RF_COST, Analyser.TIME_PERIOD);
|
||||
}
|
||||
public AnalyserComponentLogic(Machine machine) {
|
||||
super(machine, Analyser.RF_COST, Analyser.TIME_PERIOD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Analyser.SLOT_TARGET)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.analyser.error.noItem"),
|
||||
Analyser.SLOT_TARGET
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Analyser.SLOT_TARGET)) {
|
||||
return new ErrorState.NoItem(I18N.localise("genetics.machine.analyser.error.noItem"), Analyser.SLOT_TARGET);
|
||||
}
|
||||
|
||||
boolean analysed = Analyser.isAnalysed(getUtil().getStack(Analyser.SLOT_TARGET));
|
||||
if (!analysed) {
|
||||
return super.canWork();
|
||||
}
|
||||
boolean analysed = Analyser.isAnalysed(getUtil().getStack(Analyser.SLOT_TARGET));
|
||||
if (!analysed) {
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
return new ErrorState.InvalidItem(
|
||||
I18N.localise("genetics.machine.analyser.error.alreadyAnalysed.title"),
|
||||
I18N.localise("genetics.machine.analyser.error.alreadyAnalysed"),
|
||||
Analyser.SLOT_TARGET
|
||||
);
|
||||
}
|
||||
return new ErrorState.InvalidItem(
|
||||
I18N.localise("genetics.machine.analyser.error.alreadyAnalysed.title"),
|
||||
I18N.localise("genetics.machine.analyser.error.alreadyAnalysed"),
|
||||
Analyser.SLOT_TARGET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (getUtil().getSlotCharge(Analyser.SLOT_DYE) != 0.0f) {
|
||||
return super.canProgress();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (getUtil().getSlotCharge(Analyser.SLOT_DYE) != 0.0f) {
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
return new ErrorState.Item(
|
||||
I18N.localise("genetics.machine.analyser.error.insufficientDye.title"),
|
||||
I18N.localise("genetics.machine.analyser.error.insufficientDye"),
|
||||
new int[]{Analyser.SLOT_DYE}
|
||||
);
|
||||
}
|
||||
return new ErrorState.Item(
|
||||
I18N.localise("genetics.machine.analyser.error.insufficientDye.title"),
|
||||
I18N.localise("genetics.machine.analyser.error.insufficientDye"),
|
||||
new int[] {Analyser.SLOT_DYE});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
ItemStack itemStack = getUtil().getStack(Analyser.SLOT_TARGET);
|
||||
itemStack = Analyser.analyse(itemStack);
|
||||
getInventory().setInventorySlotContents(Analyser.SLOT_TARGET, itemStack);
|
||||
}
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
ItemStack itemStack = getUtil().getStack(Analyser.SLOT_TARGET);
|
||||
itemStack = Analyser.analyse(itemStack);
|
||||
getInventory().setInventorySlotContents(Analyser.SLOT_TARGET, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
getUtil().useCharge(Analyser.SLOT_DYE, Analyser.DYE_PER_TICK);
|
||||
}
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
getUtil().useCharge(Analyser.SLOT_DYE, Analyser.DYE_PER_TICK);
|
||||
}
|
||||
}
|
||||
@@ -16,52 +16,52 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class AnalyserPackage extends PackageGeneticBase implements IMachineInformation {
|
||||
public AnalyserPackage() {
|
||||
super("analyser", GeneticsTexture.Analyser, 0x9800ff, true);
|
||||
}
|
||||
public AnalyserPackage() {
|
||||
super("analyser", GeneticsTexture.Analyser, 0x9800ff, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Analyser);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlotArray(Analyser.SLOT_RESERVE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Analyser.SLOT_RESERVE)) {
|
||||
slot.setValidator(new UnanalysedSlotValidator());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Analyser);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlotArray(Analyser.SLOT_RESERVE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Analyser.SLOT_RESERVE)) {
|
||||
slot.setValidator(new UnanalysedSlotValidator());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
InventorySlot targetSlot = inventory.addSlot(Analyser.SLOT_TARGET, "analyse");
|
||||
targetSlot.setValidator(new UnanalysedSlotValidator());
|
||||
targetSlot.setReadOnly();
|
||||
targetSlot.forbidInteraction();
|
||||
InventorySlot targetSlot = inventory.addSlot(Analyser.SLOT_TARGET, "analyse");
|
||||
targetSlot.setValidator(new UnanalysedSlotValidator());
|
||||
targetSlot.setReadOnly();
|
||||
targetSlot.forbidInteraction();
|
||||
|
||||
InventorySlot dyeSlot = inventory.addSlot(Analyser.SLOT_DYE, "dye");
|
||||
dyeSlot.forbidExtraction();
|
||||
dyeSlot.setValidator(new DyeSlotValidator());
|
||||
InventorySlot dyeSlot = inventory.addSlot(Analyser.SLOT_DYE, "dye");
|
||||
dyeSlot.forbidExtraction();
|
||||
dyeSlot.setValidator(new DyeSlotValidator());
|
||||
|
||||
inventory.addSlotArray(Analyser.SLOT_FINISHED, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Analyser.SLOT_FINISHED)) {
|
||||
slot.forbidInsertion();
|
||||
slot.setReadOnly();
|
||||
}
|
||||
inventory.addSlotArray(Analyser.SLOT_FINISHED, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Analyser.SLOT_FINISHED)) {
|
||||
slot.forbidInsertion();
|
||||
slot.setReadOnly();
|
||||
}
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Analyser.SLOT_RESERVE, Analyser.SLOT_TARGET, 1);
|
||||
transfer.addStorage(Analyser.SLOT_TARGET, Analyser.SLOT_FINISHED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return Analyser.isAnalysed(stack);
|
||||
}
|
||||
});
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Analyser.SLOT_RESERVE, Analyser.SLOT_TARGET, 1);
|
||||
transfer.addStorage(Analyser.SLOT_TARGET, Analyser.SLOT_FINISHED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return Analyser.isAnalysed(stack);
|
||||
}
|
||||
});
|
||||
|
||||
new ComponentChargedSlots(machine).addCharge(Analyser.SLOT_DYE);
|
||||
new ComponentPowerReceptor(machine, 500);
|
||||
new AnalyserComponentLogic(machine);
|
||||
new AnalyserComponentFX(machine);
|
||||
}
|
||||
new ComponentChargedSlots(machine).addCharge(Analyser.SLOT_DYE);
|
||||
new ComponentPowerReceptor(machine, 500);
|
||||
new AnalyserComponentLogic(machine);
|
||||
new AnalyserComponentFX(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
@@ -7,17 +7,17 @@ import binnie.genetics.machine.ModuleMachine;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class DyeSlotValidator extends SlotValidator {
|
||||
public DyeSlotValidator() {
|
||||
super(ModuleMachine.IconDye);
|
||||
}
|
||||
public DyeSlotValidator() {
|
||||
super(ModuleMachine.IconDye);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return itemStack.isItemEqual(GeneticsItems.DNADye.get(1));
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return itemStack.isItemEqual(GeneticsItems.DNADye.get(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.analyser.dnaDye");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.analyser.dnaDye");
|
||||
}
|
||||
}
|
||||
@@ -5,18 +5,17 @@ import binnie.core.util.I18N;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class UnanalysedSlotValidator extends SlotValidator {
|
||||
public UnanalysedSlotValidator() {
|
||||
super(null);
|
||||
}
|
||||
public UnanalysedSlotValidator() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack stack) {
|
||||
return Analyser.isAnalysable(stack)
|
||||
&& !Analyser.isAnalysed(stack);
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(ItemStack stack) {
|
||||
return Analyser.isAnalysable(stack) && !Analyser.isAnalysed(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.analyser.unanalysedItem");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.analyser.unanalysedItem");
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,13 @@ import binnie.core.util.I18N;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class EthanolTankValidator extends TankValidator {
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("fluid.bioethanol");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("fluid.bioethanol");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return liquid.getFluid().getName().equals("bioethanol");
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(FluidStack liquid) {
|
||||
return liquid.getFluid().getName().equals("bioethanol");
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
package binnie.genetics.machine.genepool;
|
||||
|
||||
public class Genepool {
|
||||
public static final int SLOT_BEE = 0;
|
||||
public static final int TANK_DNA = 0;
|
||||
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 int ETHANOL_PER_TICK = 1;
|
||||
public static final int POWER_CAPACITY = 1600;
|
||||
public static final int TANK_DNA_CAPACITY = 2000;
|
||||
public static final int TANK_ETHANOL_CAPACITY = 1000;
|
||||
public static final int SLOT_BEE = 0;
|
||||
public static final int TANK_DNA = 0;
|
||||
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 int ETHANOL_PER_TICK = 1;
|
||||
public static final int POWER_CAPACITY = 1600;
|
||||
public static final int TANK_DNA_CAPACITY = 2000;
|
||||
public static final int TANK_ETHANOL_CAPACITY = 1000;
|
||||
}
|
||||
@@ -6,57 +6,70 @@ import binnie.core.machines.MachineComponent;
|
||||
import binnie.core.machines.component.IRender;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class GenepoolComponentFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
|
||||
public GenepoolComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
public GenepoolComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
// ignored
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (rand.nextFloat() >= 1.0f || !getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (rand.nextFloat() >= 1.0f || !getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.3 + rand.nextDouble() * 0.4, y + 1, z + 0.3 + rand.nextDouble() * 0.4, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = rand.nextDouble() * 2.0 * 3.1415;
|
||||
BinnieCore.proxy
|
||||
.getMinecraftInstance()
|
||||
.effectRenderer
|
||||
.addEffect(
|
||||
new EntityFX(
|
||||
world,
|
||||
x + 0.3 + rand.nextDouble() * 0.4,
|
||||
y + 1,
|
||||
z + 0.3 + rand.nextDouble() * 0.4,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = rand.nextDouble() * 2.0 * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = rand.nextFloat() * 0.01;
|
||||
particleMaxAge = 25;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.4f + 0.6f * rand.nextFloat(), 0.6f * rand.nextFloat(), 0.6f + 0.4f * rand.nextFloat());
|
||||
}
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = rand.nextFloat() * 0.01;
|
||||
particleMaxAge = 25;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(
|
||||
0.4f + 0.6f * rand.nextFloat(),
|
||||
0.6f * rand.nextFloat(),
|
||||
0.6f + 0.4f * rand.nextFloat());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,78 +14,70 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class GenepoolComponentLogic extends ComponentProcessSetCost implements IProcess, INetwork.TilePacketSync {
|
||||
private float ethanolDrain;
|
||||
private float ethanolDrain;
|
||||
|
||||
public GenepoolComponentLogic(Machine machine) {
|
||||
super(machine, Genepool.RF_COST, Genepool.TIME_PERIOD);
|
||||
ethanolDrain = 0.0f;
|
||||
}
|
||||
public GenepoolComponentLogic(Machine machine) {
|
||||
super(machine, Genepool.RF_COST, Genepool.TIME_PERIOD);
|
||||
ethanolDrain = 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Genepool.SLOT_BEE)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.genepool.error.noIndividual"),
|
||||
Genepool.SLOT_BEE
|
||||
);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Genepool.SLOT_BEE)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.genepool.error.noIndividual"), Genepool.SLOT_BEE);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!getUtil().spaceInTank(Genepool.TANK_DNA, getDNAAmount(getUtil().getStack(Genepool.TANK_DNA)))) {
|
||||
return new ErrorState.NoSpace(
|
||||
I18N.localise("genetics.machine.genepool.error.noRoom"),
|
||||
Genepool.TANK_DNA
|
||||
);
|
||||
}
|
||||
if (!getUtil().liquidInTank(Genepool.TANK_ETHANOL, 1)) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.genepool.error.noEthanol"),
|
||||
Genepool.TANK_ETHANOL
|
||||
);
|
||||
}
|
||||
if (getUtil().getSlotCharge(Genepool.SLOT_ENZYME) == 0.0f) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.genepool.error.insufficientEnzyme"),
|
||||
Genepool.SLOT_ENZYME
|
||||
);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!getUtil().spaceInTank(Genepool.TANK_DNA, getDNAAmount(getUtil().getStack(Genepool.TANK_DNA)))) {
|
||||
return new ErrorState.NoSpace(I18N.localise("genetics.machine.genepool.error.noRoom"), Genepool.TANK_DNA);
|
||||
}
|
||||
if (!getUtil().liquidInTank(Genepool.TANK_ETHANOL, 1)) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.genepool.error.noEthanol"), Genepool.TANK_ETHANOL);
|
||||
}
|
||||
if (getUtil().getSlotCharge(Genepool.SLOT_ENZYME) == 0.0f) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.genepool.error.insufficientEnzyme"), Genepool.SLOT_ENZYME);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
int amount = getDNAAmount(getUtil().getStack(Genepool.TANK_DNA));
|
||||
getUtil().fillTank(Genepool.TANK_DNA, GeneticLiquid.RawDNA.get(amount));
|
||||
getUtil().deleteStack(Genepool.TANK_DNA);
|
||||
}
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
int amount = getDNAAmount(getUtil().getStack(Genepool.TANK_DNA));
|
||||
getUtil().fillTank(Genepool.TANK_DNA, GeneticLiquid.RawDNA.get(amount));
|
||||
getUtil().deleteStack(Genepool.TANK_DNA);
|
||||
}
|
||||
|
||||
private int getDNAAmount(ItemStack stack) {
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
if (root == null ||
|
||||
root != Binnie.Genetics.getBeeRoot() ||
|
||||
Binnie.Genetics.getBeeRoot().isDrone(stack)) {
|
||||
return 10;
|
||||
}
|
||||
private int getDNAAmount(ItemStack stack) {
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
|
||||
if (root == null
|
||||
|| root != Binnie.Genetics.getBeeRoot()
|
||||
|| Binnie.Genetics.getBeeRoot().isDrone(stack)) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
if (Binnie.Genetics.getBeeRoot().isMated(stack)) {
|
||||
return 50;
|
||||
}
|
||||
return 30;
|
||||
}
|
||||
if (Binnie.Genetics.getBeeRoot().isMated(stack)) {
|
||||
return 50;
|
||||
}
|
||||
return 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
ethanolDrain += getDNAAmount(getUtil().getStack(Genepool.TANK_DNA)) * 1.2f * getProgressPerTick() / 100.0f;
|
||||
if (ethanolDrain >= 1.0f) {
|
||||
getUtil().drainTank(Genepool.TANK_ETHANOL, Genepool.ETHANOL_PER_TICK);
|
||||
ethanolDrain--;
|
||||
}
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
ethanolDrain += getDNAAmount(getUtil().getStack(Genepool.TANK_DNA)) * 1.2f * getProgressPerTick() / 100.0f;
|
||||
if (ethanolDrain >= 1.0f) {
|
||||
getUtil().drainTank(Genepool.TANK_ETHANOL, Genepool.ETHANOL_PER_TICK);
|
||||
ethanolDrain--;
|
||||
}
|
||||
|
||||
getMachine().getInterface(IChargedSlots.class)
|
||||
.alterCharge(Genepool.SLOT_ENZYME, -Genepool.ENZYME_PER_PROCESS * getProgressPerTick() / 100.0f);
|
||||
}
|
||||
getMachine()
|
||||
.getInterface(IChargedSlots.class)
|
||||
.alterCharge(Genepool.SLOT_ENZYME, -Genepool.ENZYME_PER_PROCESS * getProgressPerTick() / 100.0f);
|
||||
}
|
||||
}
|
||||
@@ -20,48 +20,48 @@ import binnie.genetics.machine.PackageGeneticBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class GenepoolPackage extends PackageGeneticBase implements IMachineInformation {
|
||||
public GenepoolPackage() {
|
||||
super("genepool", GeneticsTexture.Genepool, 0xc134b6, true);
|
||||
}
|
||||
public GenepoolPackage() {
|
||||
super("genepool", GeneticsTexture.Genepool, 0xc134b6, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Genepool);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
InventorySlot enzymeSlot = inventory.addSlot(Genepool.SLOT_ENZYME, "enzyme");
|
||||
enzymeSlot.setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.IconEnzyme));
|
||||
enzymeSlot.forbidExtraction();
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Genepool);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
InventorySlot enzymeSlot = inventory.addSlot(Genepool.SLOT_ENZYME, "enzyme");
|
||||
enzymeSlot.setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.IconEnzyme));
|
||||
enzymeSlot.forbidExtraction();
|
||||
|
||||
InventorySlot slotBee = inventory.addSlot(Genepool.SLOT_BEE, "process");
|
||||
slotBee.setValidator(new SlotValidator.Individual());
|
||||
slotBee.setReadOnly();
|
||||
slotBee.forbidExtraction();
|
||||
inventory.addSlotArray(Genepool.SLOT_RESERVE, "input");
|
||||
InventorySlot slotBee = inventory.addSlot(Genepool.SLOT_BEE, "process");
|
||||
slotBee.setValidator(new SlotValidator.Individual());
|
||||
slotBee.setReadOnly();
|
||||
slotBee.forbidExtraction();
|
||||
inventory.addSlotArray(Genepool.SLOT_RESERVE, "input");
|
||||
|
||||
for (InventorySlot slot : inventory.getSlots(Genepool.SLOT_RESERVE)) {
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
for (InventorySlot slot : inventory.getSlots(Genepool.SLOT_RESERVE)) {
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
TankSlot dnaSlot = tanks.addTank(Genepool.TANK_DNA, "output", Genepool.TANK_DNA_CAPACITY);
|
||||
dnaSlot.setReadOnly();
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
TankSlot dnaSlot = tanks.addTank(Genepool.TANK_DNA, "output", Genepool.TANK_DNA_CAPACITY);
|
||||
dnaSlot.setReadOnly();
|
||||
|
||||
TankSlot ethanolSlot = tanks.addTank(Genepool.TANK_ETHANOL, "input", Genepool.TANK_ETHANOL_CAPACITY);
|
||||
ethanolSlot.forbidExtraction();
|
||||
ethanolSlot.setValidator(new EthanolTankValidator());
|
||||
TankSlot ethanolSlot = tanks.addTank(Genepool.TANK_ETHANOL, "input", Genepool.TANK_ETHANOL_CAPACITY);
|
||||
ethanolSlot.forbidExtraction();
|
||||
ethanolSlot.setValidator(new EthanolTankValidator());
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Genepool.SLOT_RESERVE, Genepool.SLOT_BEE, 1);
|
||||
new ComponentPowerReceptor(machine, Genepool.POWER_CAPACITY);
|
||||
new GenepoolComponentLogic(machine);
|
||||
ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine);
|
||||
chargedSlots.addCharge(Genepool.SLOT_ENZYME);
|
||||
new GenepoolComponentFX(machine);
|
||||
}
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Genepool.SLOT_RESERVE, Genepool.SLOT_BEE, 1);
|
||||
new ComponentPowerReceptor(machine, Genepool.POWER_CAPACITY);
|
||||
new GenepoolComponentLogic(machine);
|
||||
ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine);
|
||||
chargedSlots.addCharge(Genepool.SLOT_ENZYME);
|
||||
new GenepoolComponentFX(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
@@ -10,15 +10,14 @@ import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Incubator {
|
||||
public static final int[] SLOT_QUEUE = new int[]{0, 1, 2};
|
||||
public static final int[] SLOT_OUTPUT = new int[]{4, 5, 6};
|
||||
public static final int[] SLOT_QUEUE = new int[] {0, 1, 2};
|
||||
public static final int[] SLOT_OUTPUT = new int[] {4, 5, 6};
|
||||
public static final int SLOT_INCUBATOR = 3;
|
||||
public static final int TANK_INPUT = 0;
|
||||
public static final int TANK_OUTPUT = 1;
|
||||
@@ -29,14 +28,41 @@ public class Incubator {
|
||||
public static final int OUTPU_TANK_CAPACITY = 2000;
|
||||
|
||||
public static void addRecipes() {
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticsItems.GrowthMedium.get(1), Binnie.Liquid.getLiquidStack("water", 25), GeneticLiquid.GrowthMedium.get(25), 0.2f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(new ItemStack(Items.wheat), GeneticLiquid.GrowthMedium.get(25), GeneticLiquid.Bacteria.get(5), 0.2f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticsItems.GrowthMedium.get(1), GeneticLiquid.Bacteria.get(0), GeneticLiquid.Bacteria.get(5), 0.05f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(new ItemStack(Items.sugar), GeneticLiquid.Bacteria.get(2), null, 0.5f, 0.2f).setOutputStack(GeneticsItems.Enzyme.get(1)));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticsItems.GrowthMedium.get(1), GeneticLiquid.BacteriaPoly.get(0), GeneticLiquid.BacteriaPoly.get(5), 0.05f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticsItems.GrowthMedium.get(1), GeneticLiquid.BacteriaVector.get(0), GeneticLiquid.BacteriaVector.get(5), 0.05f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(new ItemStack(Items.dye, 1, 15), GeneticLiquid.Bacteria.get(10), GeneticLiquid.BacteriaPoly.get(10), 0.1f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(new ItemStack(Items.blaze_powder), GeneticLiquid.Bacteria.get(10), GeneticLiquid.BacteriaVector.get(10), 0.05f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(
|
||||
GeneticsItems.GrowthMedium.get(1),
|
||||
Binnie.Liquid.getLiquidStack("water", 25),
|
||||
GeneticLiquid.GrowthMedium.get(25),
|
||||
0.2f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(
|
||||
new ItemStack(Items.wheat), GeneticLiquid.GrowthMedium.get(25), GeneticLiquid.Bacteria.get(5), 0.2f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(
|
||||
GeneticsItems.GrowthMedium.get(1),
|
||||
GeneticLiquid.Bacteria.get(0),
|
||||
GeneticLiquid.Bacteria.get(5),
|
||||
0.05f));
|
||||
Incubator.RECIPES.add(
|
||||
new IncubatorRecipe(new ItemStack(Items.sugar), GeneticLiquid.Bacteria.get(2), null, 0.5f, 0.2f)
|
||||
.setOutputStack(GeneticsItems.Enzyme.get(1)));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(
|
||||
GeneticsItems.GrowthMedium.get(1),
|
||||
GeneticLiquid.BacteriaPoly.get(0),
|
||||
GeneticLiquid.BacteriaPoly.get(5),
|
||||
0.05f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(
|
||||
GeneticsItems.GrowthMedium.get(1),
|
||||
GeneticLiquid.BacteriaVector.get(0),
|
||||
GeneticLiquid.BacteriaVector.get(5),
|
||||
0.05f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(
|
||||
new ItemStack(Items.dye, 1, 15),
|
||||
GeneticLiquid.Bacteria.get(10),
|
||||
GeneticLiquid.BacteriaPoly.get(10),
|
||||
0.1f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(
|
||||
new ItemStack(Items.blaze_powder),
|
||||
GeneticLiquid.Bacteria.get(10),
|
||||
GeneticLiquid.BacteriaVector.get(10),
|
||||
0.05f));
|
||||
|
||||
if (BinnieCore.isApicultureActive()) {
|
||||
AlleleManager.alleleRegistry.getRegisteredAlleles().values().forEach(iAllele -> {
|
||||
|
||||
Loaded 100 of 818 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user