mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-25 14:34:33 +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
@@ -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 -> {
|
||||
|
||||
@@ -7,12 +7,11 @@ import binnie.core.machines.power.IProcess;
|
||||
import binnie.core.machines.transfer.TransferRequest;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.genetics.api.IIncubatorRecipe;
|
||||
import java.util.Random;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class IncubatorComponentLogic extends ComponentProcessIndefinate implements IProcess {
|
||||
IIncubatorRecipe recipe;
|
||||
private final Random rand;
|
||||
@@ -36,8 +35,7 @@ public class IncubatorComponentLogic extends ComponentProcessIndefinate implemen
|
||||
}
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.incubator.error.noRecipe.title"),
|
||||
I18N.localise("genetics.machine.incubator.error.noRecipe")
|
||||
);
|
||||
I18N.localise("genetics.machine.incubator.error.noRecipe"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,15 +43,11 @@ public class IncubatorComponentLogic extends ComponentProcessIndefinate implemen
|
||||
if (recipe != null) {
|
||||
if (!recipe.isInputLiquidSufficient(getUtil().getFluid(Incubator.TANK_INPUT))) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.incubator.error.noLiquid"),
|
||||
Incubator.TANK_INPUT
|
||||
);
|
||||
I18N.localise("genetics.machine.incubator.error.noLiquid"), Incubator.TANK_INPUT);
|
||||
}
|
||||
if (!roomForOutput) {
|
||||
return new ErrorState.TankSpace(
|
||||
I18N.localise("genetics.machine.incubator.error.noRoom"),
|
||||
Incubator.TANK_OUTPUT
|
||||
);
|
||||
I18N.localise("genetics.machine.incubator.error.noRoom"), Incubator.TANK_OUTPUT);
|
||||
}
|
||||
}
|
||||
return super.canProgress();
|
||||
@@ -91,7 +85,11 @@ public class IncubatorComponentLogic extends ComponentProcessIndefinate implemen
|
||||
|
||||
FluidStack liquid = getUtil().getFluid(Incubator.TANK_INPUT);
|
||||
ItemStack incubator = getUtil().getStack(Incubator.SLOT_INCUBATOR);
|
||||
if (recipe != null && (incubator == null || liquid == null || !recipe.isInputLiquid(liquid) || !isStackValid(incubator, recipe))) {
|
||||
if (recipe != null
|
||||
&& (incubator == null
|
||||
|| liquid == null
|
||||
|| !recipe.isInputLiquid(liquid)
|
||||
|| !isStackValid(incubator, recipe))) {
|
||||
recipe = null;
|
||||
ItemStack leftover = new TransferRequest(incubator, getInventory())
|
||||
.setTargetSlots(Incubator.SLOT_OUTPUT)
|
||||
|
||||
@@ -14,38 +14,40 @@ import binnie.genetics.machine.PackageGeneticBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class IncubatorPackage extends PackageGeneticBase implements IMachineInformation {
|
||||
public IncubatorPackage() {
|
||||
super("incubator", GeneticsTexture.Incubator, 0xffd951, true);
|
||||
}
|
||||
public IncubatorPackage() {
|
||||
super("incubator", GeneticsTexture.Incubator, 0xffd951, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Incubator);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlotArray(Incubator.SLOT_QUEUE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Incubator.SLOT_QUEUE)) {
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Incubator);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlotArray(Incubator.SLOT_QUEUE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Incubator.SLOT_QUEUE)) {
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
InventorySlot incubatorSlot = inventory.addSlot(Incubator.SLOT_INCUBATOR, "incubator");
|
||||
incubatorSlot.forbidInteraction();
|
||||
incubatorSlot.setReadOnly();
|
||||
InventorySlot incubatorSlot = inventory.addSlot(Incubator.SLOT_INCUBATOR, "incubator");
|
||||
incubatorSlot.forbidInteraction();
|
||||
incubatorSlot.setReadOnly();
|
||||
|
||||
inventory.addSlotArray(Incubator.SLOT_OUTPUT, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Incubator.SLOT_OUTPUT)) {
|
||||
slot.forbidInsertion();
|
||||
slot.setReadOnly();
|
||||
}
|
||||
inventory.addSlotArray(Incubator.SLOT_OUTPUT, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Incubator.SLOT_OUTPUT)) {
|
||||
slot.forbidInsertion();
|
||||
slot.setReadOnly();
|
||||
}
|
||||
|
||||
new ComponentPowerReceptor(machine, Incubator.POWER_CAPACITY);
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(Incubator.TANK_INPUT, "input", Incubator.INPUT_TANK_CAPACITY).forbidExtraction();
|
||||
tanks.addTank(Incubator.TANK_OUTPUT, "output", Incubator.OUTPU_TANK_CAPACITY).setReadOnly();
|
||||
new IncubatorComponentLogic(machine);
|
||||
}
|
||||
new ComponentPowerReceptor(machine, Incubator.POWER_CAPACITY);
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(Incubator.TANK_INPUT, "input", Incubator.INPUT_TANK_CAPACITY)
|
||||
.forbidExtraction();
|
||||
tanks.addTank(Incubator.TANK_OUTPUT, "output", Incubator.OUTPU_TANK_CAPACITY)
|
||||
.setReadOnly();
|
||||
new IncubatorComponentLogic(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
@@ -3,28 +3,36 @@ package binnie.genetics.machine.incubator;
|
||||
import binnie.core.machines.MachineUtil;
|
||||
import binnie.core.machines.transfer.TransferRequest;
|
||||
import binnie.genetics.api.IIncubatorRecipe;
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
|
||||
private final FluidStack input;
|
||||
|
||||
@Nullable
|
||||
private final FluidStack output;
|
||||
|
||||
private final float lossChance;
|
||||
private final float tickChance;
|
||||
private final ItemStack inputStack;
|
||||
|
||||
@Nullable
|
||||
private ItemStack outputStack;
|
||||
|
||||
public IncubatorRecipe(ItemStack inputStack, final FluidStack input, @Nullable final FluidStack output, final float lossChance) {
|
||||
public IncubatorRecipe(
|
||||
ItemStack inputStack, final FluidStack input, @Nullable final FluidStack output, final float lossChance) {
|
||||
this(inputStack, input, output, lossChance, 1.0f);
|
||||
}
|
||||
|
||||
public IncubatorRecipe(ItemStack inputStack, final FluidStack input, @Nullable final FluidStack output, final float lossChance, final float chance) {
|
||||
public IncubatorRecipe(
|
||||
ItemStack inputStack,
|
||||
final FluidStack input,
|
||||
@Nullable final FluidStack output,
|
||||
final float lossChance,
|
||||
final float chance) {
|
||||
this.inputStack = inputStack;
|
||||
this.outputStack = null;
|
||||
this.input = input;
|
||||
@@ -88,7 +96,9 @@ public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
this.outputStack = this.getOutputStack(machine);
|
||||
if (this.outputStack != null) {
|
||||
final ItemStack output = this.outputStack.copy();
|
||||
final TransferRequest product = new TransferRequest(output, machine.getInventory()).setTargetSlots(Incubator.SLOT_OUTPUT).ignoreValidation();
|
||||
final TransferRequest product = new TransferRequest(output, machine.getInventory())
|
||||
.setTargetSlots(Incubator.SLOT_OUTPUT)
|
||||
.ignoreValidation();
|
||||
product.transfer(true);
|
||||
}
|
||||
final Random rand = machine.getRandom();
|
||||
|
||||
@@ -24,6 +24,7 @@ public class IncubatorRecipeLarvae extends IncubatorRecipe {
|
||||
|
||||
@Override
|
||||
public ItemStack getExpectedOutput() {
|
||||
return BeeManager.beeRoot.getMemberStack(BeeManager.beeRoot.getMember(this.getInputStack()), EnumBeeType.DRONE.ordinal());
|
||||
return BeeManager.beeRoot.getMemberStack(
|
||||
BeeManager.beeRoot.getMember(this.getInputStack()), EnumBeeType.DRONE.ordinal());
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,13 @@ import binnie.genetics.item.GeneticLiquid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class BacteriaVectorValidator extends Validator<FluidStack> {
|
||||
@Override
|
||||
public boolean isValid(FluidStack object) {
|
||||
return GeneticLiquid.BacteriaVector.get(1).isFluidEqual(object);
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(FluidStack object) {
|
||||
return GeneticLiquid.BacteriaVector.get(1).isFluidEqual(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return GeneticLiquid.BacteriaVector.getName();
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return GeneticLiquid.BacteriaVector.getName();
|
||||
}
|
||||
}
|
||||
+12
-12
@@ -8,18 +8,18 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class IndividualInoculateValidator extends SlotValidator {
|
||||
public IndividualInoculateValidator() {
|
||||
super(null);
|
||||
}
|
||||
public IndividualInoculateValidator() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack object) {
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(object);
|
||||
return root != null && Binnie.Genetics.getSystem(root).isDNAManipulable(object);
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(ItemStack object) {
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(object);
|
||||
return root != null && Binnie.Genetics.getSystem(root).isDNAManipulable(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.inoculator.inoculableIndividual");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.inoculator.inoculableIndividual");
|
||||
}
|
||||
}
|
||||
@@ -9,35 +9,34 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class Inoculator {
|
||||
public static final int SLOT_SERUM_VIAL = 0;
|
||||
public static final int[] SLOT_SERUM_RESERVE = new int[]{1, 2};
|
||||
public static final int[] SLOT_SERUM_EXPENDED = new int[]{3, 4};
|
||||
public static final int[] SLOT_RESERVE = new int[]{5, 6, 7, 8};
|
||||
public static final int SLOT_TARGET = 9;
|
||||
public static final int[] SLOT_FINISHED = new int[]{10, 11, 12, 13};
|
||||
public static final int TANK_VECTOR = 0;
|
||||
public static final int TANK_CAPACITY = 1000;
|
||||
public static final int RF_COST = 600000;
|
||||
public static final int TIME_PERIOD = 12000;
|
||||
public static final int POWER_STORAGE = 15000;
|
||||
public static final int SLOT_SERUM_VIAL = 0;
|
||||
public static final int[] SLOT_SERUM_RESERVE = new int[] {1, 2};
|
||||
public static final int[] SLOT_SERUM_EXPENDED = new int[] {3, 4};
|
||||
public static final int[] SLOT_RESERVE = new int[] {5, 6, 7, 8};
|
||||
public static final int SLOT_TARGET = 9;
|
||||
public static final int[] SLOT_FINISHED = new int[] {10, 11, 12, 13};
|
||||
public static final int TANK_VECTOR = 0;
|
||||
public static final int TANK_CAPACITY = 1000;
|
||||
public static final int RF_COST = 600000;
|
||||
public static final int TIME_PERIOD = 12000;
|
||||
public static final int POWER_STORAGE = 15000;
|
||||
|
||||
public static void setGene(IGene gene, ItemStack target, int chromoN) {
|
||||
int chromosomeID = gene.getChromosome().ordinal();
|
||||
if (chromosomeID >= EnumBeeChromosome.HUMIDITY.ordinal() && gene.getSpeciesRoot() instanceof IBeeRoot) {
|
||||
chromosomeID--;
|
||||
}
|
||||
public static void setGene(IGene gene, ItemStack target, int chromoN) {
|
||||
int chromosomeID = gene.getChromosome().ordinal();
|
||||
if (chromosomeID >= EnumBeeChromosome.HUMIDITY.ordinal() && gene.getSpeciesRoot() instanceof IBeeRoot) {
|
||||
chromosomeID--;
|
||||
}
|
||||
|
||||
Class<? extends IAllele> cls = gene.getChromosome().getAlleleClass();
|
||||
if (!cls.isInstance(gene.getAllele())) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound beeNBT = target.getTagCompound();
|
||||
NBTTagCompound genomeNBT = beeNBT.getCompoundTag("Genome");
|
||||
NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
|
||||
NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
|
||||
chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID());
|
||||
target.setTagCompound(beeNBT);
|
||||
}
|
||||
Class<? extends IAllele> cls = gene.getChromosome().getAlleleClass();
|
||||
if (!cls.isInstance(gene.getAllele())) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound beeNBT = target.getTagCompound();
|
||||
NBTTagCompound genomeNBT = beeNBT.getCompoundTag("Genome");
|
||||
NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
|
||||
NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
|
||||
chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID());
|
||||
target.setTagCompound(beeNBT);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -15,121 +16,122 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Random;
|
||||
public class InoculatorComponentFX extends MachineComponent
|
||||
implements IRender.RandomDisplayTick, IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync {
|
||||
private EntityItem dummyEntityItem;
|
||||
|
||||
public class InoculatorComponentFX extends MachineComponent implements
|
||||
IRender.RandomDisplayTick,
|
||||
IRender.DisplayTick,
|
||||
IRender.Render,
|
||||
INetwork.TilePacketSync {
|
||||
private EntityItem dummyEntityItem;
|
||||
public InoculatorComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
dummyEntityItem = new EntityItem(null);
|
||||
}
|
||||
|
||||
public InoculatorComponentFX(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) {
|
||||
int tick = (int) (world.getTotalWorldTime() % 3L);
|
||||
if (tick == 0 && getUtil().getProcess().isInProgress()) {
|
||||
BinnieCore.proxy
|
||||
.getMinecraftInstance()
|
||||
.effectRenderer
|
||||
.addEffect(new EntityFX(world, x + 0.5, y + 0.92, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = (int) (worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
int tick = (int) (world.getTotalWorldTime() % 3L);
|
||||
if (tick == 0 && getUtil().getProcess().isInProgress()) {
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 0.92, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = (int) (worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.007 + rand.nextDouble() * 0.002;
|
||||
particleMaxAge = 240;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.8f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.007 + rand.nextDouble() * 0.002;
|
||||
particleMaxAge = 240;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.8f, 0.0f, 1.0f);
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
double speed = 5.0E-4;
|
||||
if (particleAge > 60) {
|
||||
speed += (particleAge - 60) / 4000.0f;
|
||||
}
|
||||
angle += speed;
|
||||
double dist = 0.27;
|
||||
setPosition(axisX + dist * Math.sin(angle), posY, axisZ + dist * Math.cos(angle));
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
if (particleAge > 40) {
|
||||
setRBGColorF(
|
||||
particleRed + (1.0f - particleRed) / 10.0f,
|
||||
particleGreen + (0.0f - particleGreen) / 10.0f,
|
||||
particleBlue + (0.0f - particleBlue) / 10.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
double speed = 5.0E-4;
|
||||
if (particleAge > 60) {
|
||||
speed += (particleAge - 60) / 4000.0f;
|
||||
}
|
||||
angle += speed;
|
||||
double dist = 0.27;
|
||||
setPosition(axisX + dist * Math.sin(angle), posY, axisZ + dist * Math.cos(angle));
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
if (particleAge > 40) {
|
||||
setRBGColorF(particleRed + (1.0f - particleRed) / 10.0f, particleGreen + (0.0f - particleGreen) / 10.0f, particleBlue + (0.0f - particleBlue) / 10.0f);
|
||||
}
|
||||
}
|
||||
@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(Inoculator.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(Inoculator.SLOT_TARGET);
|
||||
dummyEntityItem.worldObj = getMachine().getWorld();
|
||||
dummyEntityItem.setEntityItemStack(stack);
|
||||
EntityItem dummyEntityItem = this.dummyEntityItem;
|
||||
dummyEntityItem.age++;
|
||||
this.dummyEntityItem.hoverStart = 0.0f;
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glTranslatef(0.0f, -0.25f, 0.0f);
|
||||
renderItem.doRender(this.dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glTranslatef(0.0f, -0.25f, 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(Inoculator.SLOT_TARGET);
|
||||
if (stack != null) {
|
||||
stack.writeToNBT(item);
|
||||
nbt.setTag("item", item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToNBT(NBTTagCompound nbt) {
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
ItemStack stack = getUtil().getStack(Inoculator.SLOT_TARGET);
|
||||
if (stack != null) {
|
||||
stack.writeToNBT(item);
|
||||
nbt.setTag("item", item);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
if (nbt.hasKey("item")) {
|
||||
getUtil().setStack(Inoculator.SLOT_TARGET, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
|
||||
} else {
|
||||
getUtil().setStack(Inoculator.SLOT_TARGET, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
if (nbt.hasKey("item")) {
|
||||
getUtil().setStack(Inoculator.SLOT_TARGET, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
|
||||
} else {
|
||||
getUtil().setStack(Inoculator.SLOT_TARGET, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryUpdate() {
|
||||
if (!getUtil().isServer()) {
|
||||
return;
|
||||
}
|
||||
getUtil().refreshBlock();
|
||||
}
|
||||
@Override
|
||||
public void onInventoryUpdate() {
|
||||
if (!getUtil().isServer()) {
|
||||
return;
|
||||
}
|
||||
getUtil().refreshBlock();
|
||||
}
|
||||
}
|
||||
@@ -17,148 +17,138 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class InoculatorComponentLogic extends ComponentProcessSetCost implements IProcess {
|
||||
private float bacteriaDrain = 0.0f;
|
||||
private float bacteriaDrain = 0.0f;
|
||||
|
||||
public InoculatorComponentLogic(Machine machine) {
|
||||
super(machine, Inoculator.RF_COST, Inoculator.TIME_PERIOD);
|
||||
}
|
||||
public InoculatorComponentLogic(Machine machine) {
|
||||
super(machine, Inoculator.RF_COST, Inoculator.TIME_PERIOD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
return super.getProcessLength() * getNumberOfGenes();
|
||||
}
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
return super.getProcessLength() * getNumberOfGenes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessEnergy() {
|
||||
return super.getProcessEnergy() * getNumberOfGenes();
|
||||
}
|
||||
@Override
|
||||
public int getProcessEnergy() {
|
||||
return super.getProcessEnergy() * getNumberOfGenes();
|
||||
}
|
||||
|
||||
private int getNumberOfGenes() {
|
||||
ItemStack serum = getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
if (serum == null) {
|
||||
return 1;
|
||||
}
|
||||
return Engineering.getGenes(serum).length;
|
||||
}
|
||||
private int getNumberOfGenes() {
|
||||
ItemStack serum = getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
if (serum == null) {
|
||||
return 1;
|
||||
}
|
||||
return Engineering.getGenes(serum).length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
int n = getNumberOfGenes();
|
||||
if (n > 1) {
|
||||
return I18N.localise("genetics.machine.inoculator.inoculatingWithGenes", n);
|
||||
}
|
||||
return I18N.localise("genetics.machine.inoculator.inoculatingWithGene");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
int n = getNumberOfGenes();
|
||||
if (n > 1) {
|
||||
return I18N.localise("genetics.machine.inoculator.inoculatingWithGenes", n);
|
||||
}
|
||||
return I18N.localise("genetics.machine.inoculator.inoculatingWithGene");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Inoculator.SLOT_TARGET)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.inoculator.error.noIndividual"),
|
||||
Inoculator.SLOT_TARGET
|
||||
);
|
||||
}
|
||||
if (getUtil().isSlotEmpty(Inoculator.SLOT_SERUM_VIAL)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.inoculator.error.noSerum"),
|
||||
Inoculator.SLOT_SERUM_VIAL
|
||||
);
|
||||
}
|
||||
if (getUtil().isTankEmpty(Inoculator.TANK_VECTOR)) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.inoculator.error.noLiquid"),
|
||||
Inoculator.TANK_VECTOR
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Inoculator.SLOT_TARGET)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.inoculator.error.noIndividual"), Inoculator.SLOT_TARGET);
|
||||
}
|
||||
if (getUtil().isSlotEmpty(Inoculator.SLOT_SERUM_VIAL)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.inoculator.error.noSerum"), Inoculator.SLOT_SERUM_VIAL);
|
||||
}
|
||||
if (getUtil().isTankEmpty(Inoculator.TANK_VECTOR)) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.inoculator.error.noLiquid"), Inoculator.TANK_VECTOR);
|
||||
}
|
||||
|
||||
ErrorState state = isValidSerum();
|
||||
if (state != null) {
|
||||
return state;
|
||||
}
|
||||
|
||||
ItemStack stack = getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
if (stack != null && Engineering.getCharges(stack) == 0) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.inoculator.error.emptySerum.title"),
|
||||
I18N.localise("genetics.machine.inoculator.error.emptySerum")
|
||||
);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
ErrorState state = isValidSerum();
|
||||
if (state != null) {
|
||||
return state;
|
||||
}
|
||||
|
||||
public ErrorState isValidSerum() {
|
||||
ItemStack serum = getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
ItemStack target = getUtil().getStack(Inoculator.SLOT_TARGET);
|
||||
IGene[] genes = Engineering.getGenes(serum);
|
||||
if (genes.length == 0) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.inoculator.error.invalidSerum.title"),
|
||||
I18N.localise("genetics.machine.inoculator.error.invalidSerum.0")
|
||||
);
|
||||
}
|
||||
if (!genes[0].getSpeciesRoot().isMember(target)) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.inoculator.error.invalidSerum.title"),
|
||||
I18N.localise("genetics.machine.inoculator.error.invalidSerum.1")
|
||||
);
|
||||
}
|
||||
ItemStack stack = getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
if (stack != null && Engineering.getCharges(stack) == 0) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.inoculator.error.emptySerum.title"),
|
||||
I18N.localise("genetics.machine.inoculator.error.emptySerum"));
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
IIndividual individual = genes[0].getSpeciesRoot().getMember(target);
|
||||
boolean hasAll = true;
|
||||
for (IGene gene : genes) {
|
||||
if (!hasAll) {
|
||||
continue;
|
||||
}
|
||||
public ErrorState isValidSerum() {
|
||||
ItemStack serum = getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
ItemStack target = getUtil().getStack(Inoculator.SLOT_TARGET);
|
||||
IGene[] genes = Engineering.getGenes(serum);
|
||||
if (genes.length == 0) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.inoculator.error.invalidSerum.title"),
|
||||
I18N.localise("genetics.machine.inoculator.error.invalidSerum.0"));
|
||||
}
|
||||
if (!genes[0].getSpeciesRoot().isMember(target)) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.inoculator.error.invalidSerum.title"),
|
||||
I18N.localise("genetics.machine.inoculator.error.invalidSerum.1"));
|
||||
}
|
||||
|
||||
IGenome genome = individual.getGenome();
|
||||
IChromosomeType chromosome = gene.getChromosome();
|
||||
String geneAlleleUID = gene.getAllele().getUID();
|
||||
IAllele a = genome.getActiveAllele(chromosome);
|
||||
IAllele b = genome.getInactiveAllele(chromosome);
|
||||
hasAll = a.getUID().equals(geneAlleleUID) && b.getUID().equals(geneAlleleUID);
|
||||
}
|
||||
IIndividual individual = genes[0].getSpeciesRoot().getMember(target);
|
||||
boolean hasAll = true;
|
||||
for (IGene gene : genes) {
|
||||
if (!hasAll) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!hasAll) {
|
||||
return null;
|
||||
}
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.inoculator.error.defunctSerum.title"),
|
||||
I18N.localise("genetics.machine.inoculator.error.defunctSerum")
|
||||
);
|
||||
}
|
||||
IGenome genome = individual.getGenome();
|
||||
IChromosomeType chromosome = gene.getChromosome();
|
||||
String geneAlleleUID = gene.getAllele().getUID();
|
||||
IAllele a = genome.getActiveAllele(chromosome);
|
||||
IAllele b = genome.getInactiveAllele(chromosome);
|
||||
hasAll = a.getUID().equals(geneAlleleUID) && b.getUID().equals(geneAlleleUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
return super.canProgress();
|
||||
}
|
||||
if (!hasAll) {
|
||||
return null;
|
||||
}
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.inoculator.error.defunctSerum.title"),
|
||||
I18N.localise("genetics.machine.inoculator.error.defunctSerum"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
ItemStack serum = getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
ItemStack target = getUtil().getStack(Inoculator.SLOT_TARGET);
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
|
||||
if (!ind.isAnalyzed()) {
|
||||
ind.analyze();
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
ind.writeToNBT(nbttagcompound);
|
||||
target.setTagCompound(nbttagcompound);
|
||||
}
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
IGene[] genes = ((IItemSerum) serum.getItem()).getGenes(serum);
|
||||
for (IGene gene : genes) {
|
||||
Inoculator.setGene(gene, target, 0);
|
||||
Inoculator.setGene(gene, target, 1);
|
||||
}
|
||||
getUtil().damageItem(Inoculator.SLOT_SERUM_VIAL, 1);
|
||||
}
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
ItemStack serum = getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
ItemStack target = getUtil().getStack(Inoculator.SLOT_TARGET);
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
|
||||
if (!ind.isAnalyzed()) {
|
||||
ind.analyze();
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
ind.writeToNBT(nbttagcompound);
|
||||
target.setTagCompound(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
bacteriaDrain += 15.0f * getProgressPerTick() / 100.0f;
|
||||
if (bacteriaDrain >= 1.0f) {
|
||||
getUtil().drainTank(Inoculator.TANK_VECTOR, 1);
|
||||
bacteriaDrain--;
|
||||
}
|
||||
}
|
||||
IGene[] genes = ((IItemSerum) serum.getItem()).getGenes(serum);
|
||||
for (IGene gene : genes) {
|
||||
Inoculator.setGene(gene, target, 0);
|
||||
Inoculator.setGene(gene, target, 1);
|
||||
}
|
||||
getUtil().damageItem(Inoculator.SLOT_SERUM_VIAL, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
bacteriaDrain += 15.0f * getProgressPerTick() / 100.0f;
|
||||
if (bacteriaDrain >= 1.0f) {
|
||||
getUtil().drainTank(Inoculator.TANK_VECTOR, 1);
|
||||
bacteriaDrain--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,79 +18,83 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class InoculatorPackage extends PackageGeneticBase implements IMachineInformation {
|
||||
public InoculatorPackage() {
|
||||
super("inoculator", GeneticsTexture.Inoculator, 0xe22235, true);
|
||||
}
|
||||
public InoculatorPackage() {
|
||||
super("inoculator", GeneticsTexture.Inoculator, 0xe22235, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Inoculator);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
SlotValidator serumValid = new SerumSlotValidator();
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Inoculator);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
SlotValidator serumValid = new SerumSlotValidator();
|
||||
|
||||
InventorySlot slotSerumVial = inventory.addSlot(Inoculator.SLOT_SERUM_VIAL, "serum.active");
|
||||
slotSerumVial.forbidInteraction();
|
||||
slotSerumVial.setReadOnly();
|
||||
slotSerumVial.setValidator(serumValid);
|
||||
InventorySlot slotSerumVial = inventory.addSlot(Inoculator.SLOT_SERUM_VIAL, "serum.active");
|
||||
slotSerumVial.forbidInteraction();
|
||||
slotSerumVial.setReadOnly();
|
||||
slotSerumVial.setValidator(serumValid);
|
||||
|
||||
inventory.addSlotArray(Inoculator.SLOT_SERUM_RESERVE, "serum.input");
|
||||
for (InventorySlot slot : inventory.getSlots(Inoculator.SLOT_SERUM_RESERVE)) {
|
||||
slot.setValidator(serumValid);
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
inventory.addSlotArray(Inoculator.SLOT_SERUM_RESERVE, "serum.input");
|
||||
for (InventorySlot slot : inventory.getSlots(Inoculator.SLOT_SERUM_RESERVE)) {
|
||||
slot.setValidator(serumValid);
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
inventory.addSlotArray(Inoculator.SLOT_SERUM_EXPENDED, "serum.output");
|
||||
for (InventorySlot slot : inventory.getSlots(Inoculator.SLOT_SERUM_EXPENDED)) {
|
||||
slot.setValidator(serumValid);
|
||||
slot.setReadOnly();
|
||||
}
|
||||
inventory.addSlotArray(Inoculator.SLOT_SERUM_EXPENDED, "serum.output");
|
||||
for (InventorySlot slot : inventory.getSlots(Inoculator.SLOT_SERUM_EXPENDED)) {
|
||||
slot.setValidator(serumValid);
|
||||
slot.setReadOnly();
|
||||
}
|
||||
|
||||
inventory.addSlotArray(Inoculator.SLOT_RESERVE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Inoculator.SLOT_RESERVE)) {
|
||||
slot.forbidExtraction();
|
||||
slot.setValidator(new IndividualInoculateValidator());
|
||||
}
|
||||
inventory.addSlotArray(Inoculator.SLOT_RESERVE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Inoculator.SLOT_RESERVE)) {
|
||||
slot.forbidExtraction();
|
||||
slot.setValidator(new IndividualInoculateValidator());
|
||||
}
|
||||
|
||||
inventory.addSlot(Inoculator.SLOT_TARGET, "process");
|
||||
inventory.getSlot(Inoculator.SLOT_TARGET).setValidator(new IndividualInoculateValidator());
|
||||
inventory.getSlot(Inoculator.SLOT_TARGET).setReadOnly();
|
||||
inventory.getSlot(Inoculator.SLOT_TARGET).forbidInteraction();
|
||||
inventory.addSlotArray(Inoculator.SLOT_FINISHED, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Inoculator.SLOT_FINISHED)) {
|
||||
slot.setReadOnly();
|
||||
slot.forbidInsertion();
|
||||
slot.setValidator(new IndividualInoculateValidator());
|
||||
}
|
||||
inventory.addSlot(Inoculator.SLOT_TARGET, "process");
|
||||
inventory.getSlot(Inoculator.SLOT_TARGET).setValidator(new IndividualInoculateValidator());
|
||||
inventory.getSlot(Inoculator.SLOT_TARGET).setReadOnly();
|
||||
inventory.getSlot(Inoculator.SLOT_TARGET).forbidInteraction();
|
||||
inventory.addSlotArray(Inoculator.SLOT_FINISHED, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Inoculator.SLOT_FINISHED)) {
|
||||
slot.setReadOnly();
|
||||
slot.forbidInsertion();
|
||||
slot.setValidator(new IndividualInoculateValidator());
|
||||
}
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Inoculator.SLOT_RESERVE, Inoculator.SLOT_TARGET, 1);
|
||||
transfer.addRestock(Inoculator.SLOT_SERUM_RESERVE, Inoculator.SLOT_SERUM_VIAL);
|
||||
transfer.addStorage(Inoculator.SLOT_SERUM_VIAL, Inoculator.SLOT_SERUM_EXPENDED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return Engineering.getCharges(stack) == 0;
|
||||
}
|
||||
});
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Inoculator.SLOT_RESERVE, Inoculator.SLOT_TARGET, 1);
|
||||
transfer.addRestock(Inoculator.SLOT_SERUM_RESERVE, Inoculator.SLOT_SERUM_VIAL);
|
||||
transfer.addStorage(
|
||||
Inoculator.SLOT_SERUM_VIAL, Inoculator.SLOT_SERUM_EXPENDED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return Engineering.getCharges(stack) == 0;
|
||||
}
|
||||
});
|
||||
|
||||
transfer.addStorage(9, Inoculator.SLOT_FINISHED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return stack != null
|
||||
&& transfer.getMachine().getMachineUtil().getStack(Inoculator.SLOT_SERUM_VIAL) != null
|
||||
&& transfer.getMachine().getInterface(InoculatorComponentLogic.class).isValidSerum() != null;
|
||||
}
|
||||
});
|
||||
transfer.addStorage(9, Inoculator.SLOT_FINISHED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return stack != null
|
||||
&& transfer.getMachine().getMachineUtil().getStack(Inoculator.SLOT_SERUM_VIAL) != null
|
||||
&& transfer.getMachine()
|
||||
.getInterface(InoculatorComponentLogic.class)
|
||||
.isValidSerum()
|
||||
!= null;
|
||||
}
|
||||
});
|
||||
|
||||
new ComponentPowerReceptor(machine, Inoculator.POWER_STORAGE);
|
||||
new InoculatorComponentLogic(machine);
|
||||
new InoculatorComponentFX(machine);
|
||||
new ComponentTankContainer(machine)
|
||||
.addTank(Inoculator.TANK_VECTOR, "input", Inoculator.TANK_CAPACITY)
|
||||
.setValidator(new BacteriaVectorValidator());
|
||||
}
|
||||
new ComponentPowerReceptor(machine, Inoculator.POWER_STORAGE);
|
||||
new InoculatorComponentLogic(machine);
|
||||
new InoculatorComponentFX(machine);
|
||||
new ComponentTankContainer(machine)
|
||||
.addTank(Inoculator.TANK_VECTOR, "input", Inoculator.TANK_CAPACITY)
|
||||
.setValidator(new BacteriaVectorValidator());
|
||||
}
|
||||
|
||||
@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 SerumSlotValidator extends SlotValidator {
|
||||
public SerumSlotValidator() {
|
||||
super(ModuleMachine.IconSerum);
|
||||
}
|
||||
public SerumSlotValidator() {
|
||||
super(ModuleMachine.IconSerum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return itemStack.getItem() instanceof IItemSerum;
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return itemStack.getItem() instanceof IItemSerum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.inoculator.serums");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.inoculator.serums");
|
||||
}
|
||||
}
|
||||
@@ -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,15 +1,15 @@
|
||||
package binnie.genetics.machine.isolator;
|
||||
|
||||
public class Isolator {
|
||||
public static final int SLOT_ENZYME = 0;
|
||||
public static final int SLOT_SEQUENCER_VIAL = 1;
|
||||
public static final int[] SLOT_RESERVE = new int[]{2, 3, 4};
|
||||
public static final int[] SLOT_FINISHED = new int[]{7, 8, 9, 10, 11, 12};
|
||||
public static final int SLOT_TARGET = 5;
|
||||
public static final int SLOT_RESULT = 6;
|
||||
public static final int TANK_ETHANOL = 0;
|
||||
public static final int RF_COST = 192000;
|
||||
public static final int TIME_PERIOD = 4800;
|
||||
public static final int POWER_CAPACITY = 20000;
|
||||
public static final int ETHANOL_CAPACITY = 1000;
|
||||
public static final int SLOT_ENZYME = 0;
|
||||
public static final int SLOT_SEQUENCER_VIAL = 1;
|
||||
public static final int[] SLOT_RESERVE = new int[] {2, 3, 4};
|
||||
public static final int[] SLOT_FINISHED = new int[] {7, 8, 9, 10, 11, 12};
|
||||
public static final int SLOT_TARGET = 5;
|
||||
public static final int SLOT_RESULT = 6;
|
||||
public static final int TANK_ETHANOL = 0;
|
||||
public static final int RF_COST = 192000;
|
||||
public static final int TIME_PERIOD = 4800;
|
||||
public static final int POWER_CAPACITY = 20000;
|
||||
public static final int ETHANOL_CAPACITY = 1000;
|
||||
}
|
||||
@@ -6,88 +6,101 @@ 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 IsolatorComponentFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
|
||||
public IsolatorComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
public IsolatorComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (!getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (!getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.4 + 0.2 * rand.nextDouble(), y + 1.6, z + 0.4 + rand.nextDouble() * 0.2, 0.0, 0.0, 0.0) {
|
||||
double angle = 0.0;
|
||||
BinnieCore.proxy
|
||||
.getMinecraftInstance()
|
||||
.effectRenderer
|
||||
.addEffect(
|
||||
new EntityFX(
|
||||
world,
|
||||
x + 0.4 + 0.2 * rand.nextDouble(),
|
||||
y + 1.6,
|
||||
z + 0.4 + rand.nextDouble() * 0.2,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0) {
|
||||
double angle = 0.0;
|
||||
|
||||
{
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = -0.012;
|
||||
particleMaxAge = 100;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.8f, 0.4f, 0.0f);
|
||||
}
|
||||
{
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = -0.012;
|
||||
particleMaxAge = 100;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.8f, 0.4f, 0.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
angle += 0.06;
|
||||
setAlphaF((float) Math.sin(3.14 * particleAge / particleMaxAge));
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
angle += 0.06;
|
||||
setAlphaF((float) Math.sin(3.14 * particleAge / particleMaxAge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
int tick = (int) (world.getTotalWorldTime() % 6L);
|
||||
if ((tick != 0 && tick != 5) || !getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
int tick = (int) (world.getTotalWorldTime() % 6L);
|
||||
if ((tick != 0 && tick != 5) || !getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = 0.7 + (int) (worldObj.getTotalWorldTime() % 2L) * 3.1415;
|
||||
BinnieCore.proxy
|
||||
.getMinecraftInstance()
|
||||
.effectRenderer
|
||||
.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = 0.7 + (int) (worldObj.getTotalWorldTime() % 2L) * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.012;
|
||||
particleMaxAge = 100;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.8f, 0.0f, 1.0f);
|
||||
}
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.012;
|
||||
particleMaxAge = 100;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.8f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
angle += 0.06;
|
||||
setPosition(axisX + 0.26 * Math.sin(angle), posY, axisZ + 0.26 * Math.cos(angle));
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
angle += 0.06;
|
||||
setPosition(axisX + 0.26 * Math.sin(angle), posY, axisZ + 0.26 * Math.cos(angle));
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -13,102 +13,93 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
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 IsolatorComponentLogic extends ComponentProcessSetCost implements IProcess {
|
||||
protected float enzymePerProcess = 0.5f;
|
||||
protected float ethanolPerProcess = 10.0f;
|
||||
protected float enzymePerProcess = 0.5f;
|
||||
protected float ethanolPerProcess = 10.0f;
|
||||
|
||||
public IsolatorComponentLogic(Machine machine) {
|
||||
super(machine, Isolator.RF_COST, Isolator.TIME_PERIOD);
|
||||
}
|
||||
public IsolatorComponentLogic(Machine machine) {
|
||||
super(machine, Isolator.RF_COST, Isolator.TIME_PERIOD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Isolator.SLOT_TARGET)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.isolator.error.noIndividual"),
|
||||
Isolator.SLOT_TARGET
|
||||
);
|
||||
}
|
||||
// TODO check slot id in validation
|
||||
if (!getUtil().isSlotEmpty(Isolator.SLOT_RESULT)) {
|
||||
return new ErrorState.NoSpace(
|
||||
I18N.localise("genetics.machine.isolator.error.noRoom"),
|
||||
Isolator.SLOT_FINISHED
|
||||
);
|
||||
}
|
||||
if (getUtil().isSlotEmpty(Isolator.SLOT_SEQUENCER_VIAL)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.isolator.error.noVials"),
|
||||
Isolator.SLOT_SEQUENCER_VIAL
|
||||
);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Isolator.SLOT_TARGET)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.isolator.error.noIndividual"), Isolator.SLOT_TARGET);
|
||||
}
|
||||
// TODO check slot id in validation
|
||||
if (!getUtil().isSlotEmpty(Isolator.SLOT_RESULT)) {
|
||||
return new ErrorState.NoSpace(
|
||||
I18N.localise("genetics.machine.isolator.error.noRoom"), Isolator.SLOT_FINISHED);
|
||||
}
|
||||
if (getUtil().isSlotEmpty(Isolator.SLOT_SEQUENCER_VIAL)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.isolator.error.noVials"), Isolator.SLOT_SEQUENCER_VIAL);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!getUtil().liquidInTank(Isolator.TANK_ETHANOL, (int) ethanolPerProcess)) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.isolator.error.noLiquid"),
|
||||
Isolator.TANK_ETHANOL
|
||||
);
|
||||
}
|
||||
if (getUtil().getSlotCharge(Isolator.SLOT_ENZYME) == 0.0f) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.isolator.error.noEnzyme"),
|
||||
Isolator.SLOT_ENZYME
|
||||
);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!getUtil().liquidInTank(Isolator.TANK_ETHANOL, (int) ethanolPerProcess)) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.isolator.error.noLiquid"), Isolator.TANK_ETHANOL);
|
||||
}
|
||||
if (getUtil().getSlotCharge(Isolator.SLOT_ENZYME) == 0.0f) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.isolator.error.noEnzyme"), Isolator.SLOT_ENZYME);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
Random rand = getMachine().getWorld().rand;
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(getUtil().getStack(Isolator.SLOT_TARGET));
|
||||
if (root == null) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
Random rand = getMachine().getWorld().rand;
|
||||
ISpeciesRoot root =
|
||||
AlleleManager.alleleRegistry.getSpeciesRoot(getUtil().getStack(Isolator.SLOT_TARGET));
|
||||
if (root == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IIndividual individual = root.getMember(getUtil().getStack(Isolator.SLOT_TARGET));
|
||||
if (individual == null) {
|
||||
return;
|
||||
}
|
||||
IIndividual individual = root.getMember(getUtil().getStack(Isolator.SLOT_TARGET));
|
||||
if (individual == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IAllele allele;
|
||||
IChromosomeType chromosome;
|
||||
Gene gene = null;
|
||||
if (getMachine().getWorld().rand.nextFloat() < 2.0f) {
|
||||
while (gene == null) {
|
||||
try {
|
||||
chromosome = root.getKaryotype()[rand.nextInt(root.getKaryotype().length)];
|
||||
allele = rand.nextBoolean() ?
|
||||
individual.getGenome().getActiveAllele(chromosome) :
|
||||
individual.getGenome().getInactiveAllele(chromosome);
|
||||
gene = Gene.create(allele, chromosome, root);
|
||||
} catch (Exception e) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
IAllele allele;
|
||||
IChromosomeType chromosome;
|
||||
Gene gene = null;
|
||||
if (getMachine().getWorld().rand.nextFloat() < 2.0f) {
|
||||
while (gene == null) {
|
||||
try {
|
||||
chromosome = root.getKaryotype()[rand.nextInt(root.getKaryotype().length)];
|
||||
allele = rand.nextBoolean()
|
||||
? individual.getGenome().getActiveAllele(chromosome)
|
||||
: individual.getGenome().getInactiveAllele(chromosome);
|
||||
gene = Gene.create(allele, chromosome, root);
|
||||
} catch (Exception e) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack serum = ItemSequence.create(gene);
|
||||
getUtil().setStack(Isolator.SLOT_RESULT, serum);
|
||||
getUtil().decreaseStack(Isolator.SLOT_SEQUENCER_VIAL, 1);
|
||||
if (rand.nextFloat() < 0.05f) {
|
||||
getUtil().decreaseStack(Isolator.SLOT_TARGET, 1);
|
||||
}
|
||||
getUtil().drainTank(Isolator.TANK_ETHANOL, (int) ethanolPerProcess);
|
||||
}
|
||||
ItemStack serum = ItemSequence.create(gene);
|
||||
getUtil().setStack(Isolator.SLOT_RESULT, serum);
|
||||
getUtil().decreaseStack(Isolator.SLOT_SEQUENCER_VIAL, 1);
|
||||
if (rand.nextFloat() < 0.05f) {
|
||||
getUtil().decreaseStack(Isolator.SLOT_TARGET, 1);
|
||||
}
|
||||
getUtil().drainTank(Isolator.TANK_ETHANOL, (int) ethanolPerProcess);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
getMachine().getInterface(IChargedSlots.class)
|
||||
.alterCharge(Isolator.SLOT_ENZYME, -enzymePerProcess * getProgressPerTick() / 100.0f);
|
||||
}
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
getMachine()
|
||||
.getInterface(IChargedSlots.class)
|
||||
.alterCharge(Isolator.SLOT_ENZYME, -enzymePerProcess * getProgressPerTick() / 100.0f);
|
||||
}
|
||||
}
|
||||
@@ -19,60 +19,60 @@ import binnie.genetics.machine.PackageGeneticBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class IsolatorPackage extends PackageGeneticBase implements IMachineInformation {
|
||||
public IsolatorPackage() {
|
||||
super("isolator", GeneticsTexture.Isolator, 0xff6f0f, true);
|
||||
}
|
||||
public IsolatorPackage() {
|
||||
super("isolator", GeneticsTexture.Isolator, 0xff6f0f, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Isolator);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
InventorySlot enzymeSlot = inventory.addSlot(Isolator.SLOT_ENZYME, "enzyme");
|
||||
enzymeSlot.setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.IconEnzyme));
|
||||
enzymeSlot.forbidExtraction();
|
||||
|
||||
InventorySlot vialSlot = inventory.addSlot(Isolator.SLOT_SEQUENCER_VIAL, "sequencervial");
|
||||
vialSlot.setValidator(new SlotValidator.Item(GeneticsItems.EmptySequencer.get(1), ModuleMachine.IconSequencer));
|
||||
vialSlot.forbidExtraction();
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Isolator);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
InventorySlot enzymeSlot = inventory.addSlot(Isolator.SLOT_ENZYME, "enzyme");
|
||||
enzymeSlot.setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.IconEnzyme));
|
||||
enzymeSlot.forbidExtraction();
|
||||
|
||||
inventory.addSlotArray(Isolator.SLOT_RESERVE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Isolator.SLOT_RESERVE)) {
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
InventorySlot vialSlot = inventory.addSlot(Isolator.SLOT_SEQUENCER_VIAL, "sequencervial");
|
||||
vialSlot.setValidator(new SlotValidator.Item(GeneticsItems.EmptySequencer.get(1), ModuleMachine.IconSequencer));
|
||||
vialSlot.forbidExtraction();
|
||||
|
||||
InventorySlot targetSlot = inventory.addSlot(Isolator.SLOT_TARGET, "process");
|
||||
targetSlot.setValidator(new SlotValidator.Individual());
|
||||
targetSlot.setReadOnly();
|
||||
targetSlot.forbidInteraction();
|
||||
inventory.addSlotArray(Isolator.SLOT_RESERVE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Isolator.SLOT_RESERVE)) {
|
||||
slot.setValidator(new SlotValidator.Individual());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
InventorySlot resultSlot = inventory.addSlot(Isolator.SLOT_RESULT, "output");
|
||||
resultSlot.setReadOnly();
|
||||
resultSlot.forbidInteraction();
|
||||
InventorySlot targetSlot = inventory.addSlot(Isolator.SLOT_TARGET, "process");
|
||||
targetSlot.setValidator(new SlotValidator.Individual());
|
||||
targetSlot.setReadOnly();
|
||||
targetSlot.forbidInteraction();
|
||||
|
||||
inventory.addSlotArray(Isolator.SLOT_FINISHED, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Isolator.SLOT_FINISHED)) {
|
||||
slot.setReadOnly();
|
||||
slot.forbidInsertion();
|
||||
}
|
||||
InventorySlot resultSlot = inventory.addSlot(Isolator.SLOT_RESULT, "output");
|
||||
resultSlot.setReadOnly();
|
||||
resultSlot.forbidInteraction();
|
||||
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(Isolator.TANK_ETHANOL, "input", Isolator.ETHANOL_CAPACITY);
|
||||
tanks.getTankSlot(Isolator.TANK_ETHANOL).setValidator(new EthanolTankValidator());
|
||||
inventory.addSlotArray(Isolator.SLOT_FINISHED, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Isolator.SLOT_FINISHED)) {
|
||||
slot.setReadOnly();
|
||||
slot.forbidInsertion();
|
||||
}
|
||||
|
||||
ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine);
|
||||
chargedSlots.addCharge(Isolator.SLOT_ENZYME);
|
||||
ComponentTankContainer tanks = new ComponentTankContainer(machine);
|
||||
tanks.addTank(Isolator.TANK_ETHANOL, "input", Isolator.ETHANOL_CAPACITY);
|
||||
tanks.getTankSlot(Isolator.TANK_ETHANOL).setValidator(new EthanolTankValidator());
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Isolator.SLOT_RESERVE, Isolator.SLOT_TARGET, 1);
|
||||
transfer.addStorage(Isolator.SLOT_RESULT, Isolator.SLOT_FINISHED);
|
||||
new ComponentPowerReceptor(machine, Isolator.POWER_CAPACITY);
|
||||
new IsolatorComponentLogic(machine);
|
||||
new IsolatorComponentFX(machine);
|
||||
}
|
||||
ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine);
|
||||
chargedSlots.addCharge(Isolator.SLOT_ENZYME);
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Isolator.SLOT_RESERVE, Isolator.SLOT_TARGET, 1);
|
||||
transfer.addStorage(Isolator.SLOT_RESULT, Isolator.SLOT_FINISHED);
|
||||
new ComponentPowerReceptor(machine, Isolator.POWER_CAPACITY);
|
||||
new IsolatorComponentLogic(machine);
|
||||
new IsolatorComponentFX(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
@@ -8,17 +8,17 @@ import binnie.genetics.machine.PackageGeneticBase;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
|
||||
public class LabMachinePackage extends PackageGeneticBase {
|
||||
public LabMachinePackage() {
|
||||
super("labMachine", GeneticsTexture.LabMachine, 0xffffff, false);
|
||||
}
|
||||
public LabMachinePackage() {
|
||||
super("labMachine", GeneticsTexture.LabMachine, 0xffffff, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGUIHolder(machine);
|
||||
}
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGUIHolder(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
|
||||
MachineRendererLab.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) {
|
||||
MachineRendererLab.instance.renderMachine(machine, color, renderTexture, x, y, z, partialTick);
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,13 @@ import binnie.genetics.item.GeneticLiquid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
class DnaValidator extends Validator<FluidStack> {
|
||||
@Override
|
||||
public boolean isValid(FluidStack itemStack) {
|
||||
return GeneticLiquid.RawDNA.get(1).isFluidEqual(itemStack);
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(FluidStack itemStack) {
|
||||
return GeneticLiquid.RawDNA.get(1).isFluidEqual(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("fluid.binnie.dna.raw");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("fluid.binnie.dna.raw");
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package binnie.genetics.machine.polymeriser;
|
||||
|
||||
public class Polymeriser {
|
||||
public static final int TANK_BACTERIA = 0;
|
||||
public static final int TANK_DNA = 1;
|
||||
public static final int SLOT_SERUM = 0;
|
||||
public static final int SLOT_GOLD = 1;
|
||||
public static final int[] SLOT_SERUM_RESERVE = new int[]{2, 3, 4, 5};
|
||||
public static final int[] SLOT_SERUM_FINISHED = new int[]{6, 7, 8, 9};
|
||||
public static final int RF_COST = 96000;
|
||||
public static final int TIME_PERIOD = 2400;
|
||||
public static final int BACTERIA_TANK_CAPACITY = 1000;
|
||||
public static final int DNA_TANK_CAPACITY = 1000;
|
||||
public static final int POWER_CAPACITY = 8000;
|
||||
public static final int TANK_BACTERIA = 0;
|
||||
public static final int TANK_DNA = 1;
|
||||
public static final int SLOT_SERUM = 0;
|
||||
public static final int SLOT_GOLD = 1;
|
||||
public static final int[] SLOT_SERUM_RESERVE = new int[] {2, 3, 4, 5};
|
||||
public static final int[] SLOT_SERUM_FINISHED = new int[] {6, 7, 8, 9};
|
||||
public static final int RF_COST = 96000;
|
||||
public static final int TIME_PERIOD = 2400;
|
||||
public static final int BACTERIA_TANK_CAPACITY = 1000;
|
||||
public static final int DNA_TANK_CAPACITY = 1000;
|
||||
public static final int POWER_CAPACITY = 8000;
|
||||
}
|
||||
@@ -6,73 +6,78 @@ 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 PolymeriserComponentFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
|
||||
public PolymeriserComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
public PolymeriserComponentFX(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) {
|
||||
int tick = (int) (world.getTotalWorldTime() % 8L);
|
||||
if ((tick == 0 || tick == 3) && getUtil().getProcess().isInProgress()) {
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1.8, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = 0.7 + (int) (worldObj.getTotalWorldTime() % 2L) * 3.1415;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
int tick = (int) (world.getTotalWorldTime() % 8L);
|
||||
if ((tick == 0 || tick == 3) && getUtil().getProcess().isInProgress()) {
|
||||
BinnieCore.proxy
|
||||
.getMinecraftInstance()
|
||||
.effectRenderer
|
||||
.addEffect(new EntityFX(world, x + 0.5, y + 1.8, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = 0.7 + (int) (worldObj.getTotalWorldTime() % 2L) * 3.1415;
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = -0.006;
|
||||
particleMaxAge = 140;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.8f, 0.0f, 1.0f);
|
||||
}
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = -0.006;
|
||||
particleMaxAge = 140;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.8f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
angle += 0.1;
|
||||
motionY = -0.006;
|
||||
double dist = 0.2;
|
||||
if (particleAge > 60) {
|
||||
if (particleAge > 120) {
|
||||
dist = 0.1;
|
||||
} else {
|
||||
dist = 0.2 - 0.1 * ((particleAge - 60.0f) / 60.0f);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
angle += 0.1;
|
||||
motionY = -0.006;
|
||||
double dist = 0.2;
|
||||
if (particleAge > 60) {
|
||||
if (particleAge > 120) {
|
||||
dist = 0.1;
|
||||
} else {
|
||||
dist = 0.2 - 0.1 * ((particleAge - 60.0f) / 60.0f);
|
||||
}
|
||||
}
|
||||
|
||||
setPosition(axisX + dist * Math.sin(angle), posY, axisZ + dist * Math.cos(angle));
|
||||
if (particleAge <= 40) {
|
||||
setAlphaF(particleAge / 40.0f);
|
||||
}
|
||||
if (particleAge > 80) {
|
||||
setRBGColorF(particleRed + (0.0f - particleRed) / 10.0f, particleGreen + (1.0f - particleGreen) / 10.0f, particleBlue + (1.0f - particleBlue) / 10.0f);
|
||||
}
|
||||
}
|
||||
setPosition(axisX + dist * Math.sin(angle), posY, axisZ + dist * Math.cos(angle));
|
||||
if (particleAge <= 40) {
|
||||
setAlphaF(particleAge / 40.0f);
|
||||
}
|
||||
if (particleAge > 80) {
|
||||
setRBGColorF(
|
||||
particleRed + (0.0f - particleRed) / 10.0f,
|
||||
particleGreen + (1.0f - particleGreen) / 10.0f,
|
||||
particleBlue + (1.0f - particleBlue) / 10.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,105 +9,100 @@ import binnie.genetics.genetics.Engineering;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PolymeriserComponentLogic extends ComponentProcessSetCost implements IProcess {
|
||||
private static float chargePerProcess = 0.4f;
|
||||
private static float chargePerProcess = 0.4f;
|
||||
|
||||
private float dnaDrain = 0.0f;
|
||||
private float bacteriaDrain = 0.0f;
|
||||
private float dnaDrain = 0.0f;
|
||||
private float bacteriaDrain = 0.0f;
|
||||
|
||||
public PolymeriserComponentLogic(Machine machine) {
|
||||
super(machine, Polymeriser.RF_COST, Polymeriser.TIME_PERIOD);
|
||||
}
|
||||
public PolymeriserComponentLogic(Machine machine) {
|
||||
super(machine, Polymeriser.RF_COST, Polymeriser.TIME_PERIOD);
|
||||
}
|
||||
|
||||
private float getCatalyst() {
|
||||
return (getUtil().getSlotCharge(Polymeriser.SLOT_GOLD) > 0.0f) ? 0.2f : 1.0f;
|
||||
}
|
||||
private float getCatalyst() {
|
||||
return (getUtil().getSlotCharge(Polymeriser.SLOT_GOLD) > 0.0f) ? 0.2f : 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
return (int) (super.getProcessLength() * getNumberOfGenes() * getCatalyst());
|
||||
}
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
return (int) (super.getProcessLength() * getNumberOfGenes() * getCatalyst());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessEnergy() {
|
||||
return (int) (super.getProcessEnergy() * getNumberOfGenes() * getCatalyst());
|
||||
}
|
||||
@Override
|
||||
public int getProcessEnergy() {
|
||||
return (int) (super.getProcessEnergy() * getNumberOfGenes() * getCatalyst());
|
||||
}
|
||||
|
||||
private float getDNAPerProcess() {
|
||||
return getNumberOfGenes() * 50;
|
||||
}
|
||||
private float getDNAPerProcess() {
|
||||
return getNumberOfGenes() * 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTickTask() {
|
||||
super.onTickTask();
|
||||
getUtil().useCharge(Polymeriser.SLOT_GOLD, PolymeriserComponentLogic.chargePerProcess * getProgressPerTick() / 100.0f);
|
||||
dnaDrain += getDNAPerProcess() * getProgressPerTick() / 100.0f;
|
||||
bacteriaDrain += 0.2f * getDNAPerProcess() * getProgressPerTick() / 100.0f;
|
||||
@Override
|
||||
public void onTickTask() {
|
||||
super.onTickTask();
|
||||
getUtil()
|
||||
.useCharge(
|
||||
Polymeriser.SLOT_GOLD,
|
||||
PolymeriserComponentLogic.chargePerProcess * getProgressPerTick() / 100.0f);
|
||||
dnaDrain += getDNAPerProcess() * getProgressPerTick() / 100.0f;
|
||||
bacteriaDrain += 0.2f * getDNAPerProcess() * getProgressPerTick() / 100.0f;
|
||||
|
||||
if (dnaDrain >= 1.0f) {
|
||||
getUtil().drainTank(Polymeriser.TANK_DNA, 1);
|
||||
dnaDrain--;
|
||||
}
|
||||
if (dnaDrain >= 1.0f) {
|
||||
getUtil().drainTank(Polymeriser.TANK_DNA, 1);
|
||||
dnaDrain--;
|
||||
}
|
||||
|
||||
if (bacteriaDrain >= 1.0f) {
|
||||
getUtil().drainTank(Polymeriser.TANK_BACTERIA, 1);
|
||||
bacteriaDrain--;
|
||||
}
|
||||
}
|
||||
if (bacteriaDrain >= 1.0f) {
|
||||
getUtil().drainTank(Polymeriser.TANK_BACTERIA, 1);
|
||||
bacteriaDrain--;
|
||||
}
|
||||
}
|
||||
|
||||
private int getNumberOfGenes() {
|
||||
ItemStack serum = getUtil().getStack(Polymeriser.SLOT_SERUM);
|
||||
if (serum == null) {
|
||||
return 1;
|
||||
}
|
||||
return Engineering.getGenes(serum).length;
|
||||
}
|
||||
private int getNumberOfGenes() {
|
||||
ItemStack serum = getUtil().getStack(Polymeriser.SLOT_SERUM);
|
||||
if (serum == null) {
|
||||
return 1;
|
||||
}
|
||||
return Engineering.getGenes(serum).length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
int n = getNumberOfGenes();
|
||||
if (n > 1) {
|
||||
return I18N.localise("genetics.machine.polymeriser.replicatingWithGenes", n);
|
||||
}
|
||||
return I18N.localise("genetics.machine.polymeriser.replicatingWithGene");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
int n = getNumberOfGenes();
|
||||
if (n > 1) {
|
||||
return I18N.localise("genetics.machine.polymeriser.replicatingWithGenes", n);
|
||||
}
|
||||
return I18N.localise("genetics.machine.polymeriser.replicatingWithGene");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Polymeriser.SLOT_SERUM)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.polymeriser.error.noItem"),
|
||||
Polymeriser.SLOT_SERUM
|
||||
);
|
||||
}
|
||||
if (!getUtil().getStack(Polymeriser.SLOT_SERUM).isItemDamaged()) {
|
||||
return new ErrorState.InvalidItem(
|
||||
I18N.localise("genetics.machine.polymeriser.error.itemFilled"),
|
||||
Polymeriser.SLOT_SERUM
|
||||
);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Polymeriser.SLOT_SERUM)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.polymeriser.error.noItem"), Polymeriser.SLOT_SERUM);
|
||||
}
|
||||
if (!getUtil().getStack(Polymeriser.SLOT_SERUM).isItemDamaged()) {
|
||||
return new ErrorState.InvalidItem(
|
||||
I18N.localise("genetics.machine.polymeriser.error.itemFilled"), Polymeriser.SLOT_SERUM);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (getUtil().getFluid(Polymeriser.TANK_BACTERIA) == null) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.polymeriser.error.noLiquid"),
|
||||
Polymeriser.TANK_BACTERIA
|
||||
);
|
||||
}
|
||||
if (getUtil().getFluid(Polymeriser.TANK_DNA) == null) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.polymeriser.error.noDNA"),
|
||||
Polymeriser.TANK_DNA
|
||||
);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (getUtil().getFluid(Polymeriser.TANK_BACTERIA) == null) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.polymeriser.error.noLiquid"), Polymeriser.TANK_BACTERIA);
|
||||
}
|
||||
if (getUtil().getFluid(Polymeriser.TANK_DNA) == null) {
|
||||
return new ErrorState.InsufficientLiquid(
|
||||
I18N.localise("genetics.machine.polymeriser.error.noDNA"), Polymeriser.TANK_DNA);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
getUtil().damageItem(Polymeriser.SLOT_SERUM, -1);
|
||||
}
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
getUtil().damageItem(Polymeriser.SLOT_SERUM, -1);
|
||||
}
|
||||
}
|
||||
@@ -20,56 +20,57 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class PolymeriserPackage extends PackageGeneticBase implements IMachineInformation {
|
||||
public PolymeriserPackage() {
|
||||
super("polymeriser", GeneticsTexture.Polymeriser, 0x00e5c3, true);
|
||||
}
|
||||
public PolymeriserPackage() {
|
||||
super("polymeriser", GeneticsTexture.Polymeriser, 0x00e5c3, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Replicator);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
InventorySlot goldSlot = inventory.addSlot(Polymeriser.SLOT_GOLD, "catalyst");
|
||||
goldSlot.setValidator(new SlotValidator.Item(new ItemStack(Items.gold_nugget, 1), ModuleMachine.IconNugget));
|
||||
goldSlot.forbidExtraction();
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Replicator);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
InventorySlot goldSlot = inventory.addSlot(Polymeriser.SLOT_GOLD, "catalyst");
|
||||
goldSlot.setValidator(new SlotValidator.Item(new ItemStack(Items.gold_nugget, 1), ModuleMachine.IconNugget));
|
||||
goldSlot.forbidExtraction();
|
||||
|
||||
InventorySlot serumSlot = inventory.addSlot(Polymeriser.SLOT_SERUM, "process");
|
||||
serumSlot.setValidator(new UnfilledSerumSlotValidator());
|
||||
serumSlot.forbidInteraction();
|
||||
serumSlot.setReadOnly();
|
||||
InventorySlot serumSlot = inventory.addSlot(Polymeriser.SLOT_SERUM, "process");
|
||||
serumSlot.setValidator(new UnfilledSerumSlotValidator());
|
||||
serumSlot.forbidInteraction();
|
||||
serumSlot.setReadOnly();
|
||||
|
||||
for (InventorySlot slot : inventory.addSlotArray(Polymeriser.SLOT_SERUM_RESERVE, "input")) {
|
||||
slot.setValidator(new UnfilledSerumSlotValidator());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
for (InventorySlot slot : inventory.addSlotArray(Polymeriser.SLOT_SERUM_RESERVE, "input")) {
|
||||
slot.setValidator(new UnfilledSerumSlotValidator());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
for (InventorySlot slot : inventory.addSlotArray(Polymeriser.SLOT_SERUM_FINISHED, "output")) {
|
||||
slot.setReadOnly();
|
||||
}
|
||||
for (InventorySlot slot : inventory.addSlotArray(Polymeriser.SLOT_SERUM_FINISHED, "output")) {
|
||||
slot.setReadOnly();
|
||||
}
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Polymeriser.SLOT_SERUM_RESERVE, Polymeriser.SLOT_SERUM, 1);
|
||||
transfer.addStorage(Polymeriser.SLOT_SERUM, Polymeriser.SLOT_SERUM_FINISHED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return !stack.isItemDamaged();
|
||||
}
|
||||
});
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Polymeriser.SLOT_SERUM_RESERVE, Polymeriser.SLOT_SERUM, 1);
|
||||
transfer.addStorage(
|
||||
Polymeriser.SLOT_SERUM, Polymeriser.SLOT_SERUM_FINISHED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return !stack.isItemDamaged();
|
||||
}
|
||||
});
|
||||
|
||||
ComponentTankContainer tank = new ComponentTankContainer(machine);
|
||||
tank.addTank(Polymeriser.TANK_BACTERIA, "input", Polymeriser.BACTERIA_TANK_CAPACITY);
|
||||
tank.getTankSlot(Polymeriser.TANK_BACTERIA).setValidator(new PolymerisingBacteriaValidator());
|
||||
ComponentTankContainer tank = new ComponentTankContainer(machine);
|
||||
tank.addTank(Polymeriser.TANK_BACTERIA, "input", Polymeriser.BACTERIA_TANK_CAPACITY);
|
||||
tank.getTankSlot(Polymeriser.TANK_BACTERIA).setValidator(new PolymerisingBacteriaValidator());
|
||||
|
||||
tank.addTank(Polymeriser.TANK_DNA, "input", Polymeriser.DNA_TANK_CAPACITY);
|
||||
tank.getTankSlot(Polymeriser.TANK_DNA).setValidator(new DnaValidator());
|
||||
tank.addTank(Polymeriser.TANK_DNA, "input", Polymeriser.DNA_TANK_CAPACITY);
|
||||
tank.getTankSlot(Polymeriser.TANK_DNA).setValidator(new DnaValidator());
|
||||
|
||||
new ComponentChargedSlots(machine).addCharge(Polymeriser.SLOT_GOLD);
|
||||
new ComponentPowerReceptor(machine, Polymeriser.POWER_CAPACITY);
|
||||
new PolymeriserComponentLogic(machine);
|
||||
new PolymeriserComponentFX(machine);
|
||||
}
|
||||
new ComponentChargedSlots(machine).addCharge(Polymeriser.SLOT_GOLD);
|
||||
new ComponentPowerReceptor(machine, Polymeriser.POWER_CAPACITY);
|
||||
new PolymeriserComponentLogic(machine);
|
||||
new PolymeriserComponentFX(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -6,13 +6,13 @@ import binnie.genetics.item.GeneticLiquid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
class PolymerisingBacteriaValidator extends Validator<FluidStack> {
|
||||
@Override
|
||||
public boolean isValid(FluidStack itemStack) {
|
||||
return GeneticLiquid.BacteriaPoly.get(1).isFluidEqual(itemStack);
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(FluidStack itemStack) {
|
||||
return GeneticLiquid.BacteriaPoly.get(1).isFluidEqual(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("fluid.binnie.bacteriaPoly");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("fluid.binnie.bacteriaPoly");
|
||||
}
|
||||
}
|
||||
@@ -7,17 +7,17 @@ import binnie.genetics.machine.ModuleMachine;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class UnfilledSerumSlotValidator extends SlotValidator {
|
||||
public UnfilledSerumSlotValidator() {
|
||||
super(ModuleMachine.IconSerum);
|
||||
}
|
||||
public UnfilledSerumSlotValidator() {
|
||||
super(ModuleMachine.IconSerum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return itemStack.getItem() instanceof IItemChargable;
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return itemStack.getItem() instanceof IItemChargable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.polymeriser.unfilledSerum");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.polymeriser.unfilledSerum");
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,14 @@ package binnie.genetics.machine.sequencer;
|
||||
import binnie.core.resource.BinnieIcon;
|
||||
|
||||
public class Sequencer {
|
||||
public static final int[] SLOT_RESERVE = new int[]{1, 2, 3, 4};
|
||||
public static final int SLOT_DYE_INDEX = 0;
|
||||
public static final int SLOT_TARGET_INDEX = 5;
|
||||
public static final int SLOT_DONE_INDEX = 6;
|
||||
public static final int POWER_CAPACITY = 10000;
|
||||
public static final int[] SLOT_RESERVE = new int[] {1, 2, 3, 4};
|
||||
public static final int SLOT_DYE_INDEX = 0;
|
||||
public static final int SLOT_TARGET_INDEX = 5;
|
||||
public static final int SLOT_DONE_INDEX = 6;
|
||||
public static final int POWER_CAPACITY = 10000;
|
||||
|
||||
public static BinnieIcon fxSeqA;
|
||||
public static BinnieIcon fxSeqG;
|
||||
public static BinnieIcon fxSeqT;
|
||||
public static BinnieIcon fxSeqC;
|
||||
public static BinnieIcon fxSeqA;
|
||||
public static BinnieIcon fxSeqG;
|
||||
public static BinnieIcon fxSeqT;
|
||||
public static BinnieIcon fxSeqC;
|
||||
}
|
||||
@@ -7,96 +7,99 @@ import binnie.core.machines.component.IRender;
|
||||
import binnie.core.resource.BinnieIcon;
|
||||
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 SequencerComponentFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
|
||||
public SequencerComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
public SequencerComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (!getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if (!getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1.2 + 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;
|
||||
BinnieCore.proxy
|
||||
.getMinecraftInstance()
|
||||
.effectRenderer
|
||||
.addEffect(new EntityFX(world, x + 0.5, y + 1.2 + 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.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.0;
|
||||
particleMaxAge = 200;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.6f + rand.nextFloat() * 0.2f, 1.0f, 0.8f * rand.nextFloat() * 0.2f);
|
||||
}
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.0;
|
||||
particleMaxAge = 200;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.6f + rand.nextFloat() * 0.2f, 1.0f, 0.8f * rand.nextFloat() * 0.2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
angle += 0.03;
|
||||
setPosition(axisX + 0.4 * Math.sin(angle), posY, axisZ + 0.4 * Math.cos(angle));
|
||||
motionY = 0.0;
|
||||
setAlphaF((float) Math.sin(3.14 * particleAge / particleMaxAge));
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
angle += 0.03;
|
||||
setPosition(axisX + 0.4 * Math.sin(angle), posY, axisZ + 0.4 * Math.cos(angle));
|
||||
motionY = 0.0;
|
||||
setAlphaF((float) Math.sin(3.14 * particleAge / particleMaxAge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
int ticks = (int) (world.getTotalWorldTime() % 16L);
|
||||
if (ticks != 0 || !getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
int ticks = (int) (world.getTotalWorldTime() % 16L);
|
||||
if (ticks != 0 || !getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
{
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.012;
|
||||
particleMaxAge = 50;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
particleScale = 2.0f;
|
||||
BinnieCore.proxy
|
||||
.getMinecraftInstance()
|
||||
.effectRenderer
|
||||
.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
{
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = 0.012;
|
||||
particleMaxAge = 50;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
particleScale = 2.0f;
|
||||
|
||||
setParticleIcon((new BinnieIcon[]{
|
||||
Sequencer.fxSeqA,
|
||||
Sequencer.fxSeqG,
|
||||
Sequencer.fxSeqC,
|
||||
Sequencer.fxSeqT
|
||||
})[rand.nextInt(4)].getIcon());
|
||||
}
|
||||
setParticleIcon((new BinnieIcon[] {
|
||||
Sequencer.fxSeqA, Sequencer.fxSeqG, Sequencer.fxSeqC, Sequencer.fxSeqT
|
||||
})
|
||||
[rand.nextInt(4)].getIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
motionY = 0.012;
|
||||
if (particleAge > 40) {
|
||||
setAlphaF((50 - particleAge) / 10.0f);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
motionY = 0.012;
|
||||
if (particleAge > 40) {
|
||||
setAlphaF((50 - particleAge) / 10.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -11,112 +11,106 @@ import binnie.genetics.genetics.SequencerItem;
|
||||
import binnie.genetics.item.GeneticsItems;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SequencerComponentLogic extends ComponentProcess implements IProcess, ComponentInventoryTransfer.ITransferRestockListener {
|
||||
public SequencerComponentLogic(Machine machine) {
|
||||
super(machine);
|
||||
}
|
||||
public class SequencerComponentLogic extends ComponentProcess
|
||||
implements IProcess, ComponentInventoryTransfer.ITransferRestockListener {
|
||||
public SequencerComponentLogic(Machine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
public float getSequenceStrength() {
|
||||
ItemStack stack = getUtil().getStack(Sequencer.SLOT_TARGET_INDEX);
|
||||
if (stack == null) {
|
||||
return 1.0f;
|
||||
}
|
||||
public float getSequenceStrength() {
|
||||
ItemStack stack = getUtil().getStack(Sequencer.SLOT_TARGET_INDEX);
|
||||
if (stack == null) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
float mult = 1.0f - stack.getItemDamage() % 6 / 5.0f;
|
||||
return 1.0f - mult * mult * 0.75f;
|
||||
}
|
||||
float mult = 1.0f - stack.getItemDamage() % 6 / 5.0f;
|
||||
return 1.0f - mult * mult * 0.75f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
return (int) (19200.0f * getSequenceStrength());
|
||||
}
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
return (int) (19200.0f * getSequenceStrength());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessEnergy() {
|
||||
return getProcessLength() * 20;
|
||||
}
|
||||
@Override
|
||||
public int getProcessEnergy() {
|
||||
return getProcessLength() * 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Sequencer.SLOT_TARGET_INDEX)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.sequencer.error.noSequence"),
|
||||
Sequencer.SLOT_TARGET_INDEX
|
||||
);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Sequencer.SLOT_TARGET_INDEX)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.sequencer.error.noSequence"), Sequencer.SLOT_TARGET_INDEX);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (getMachine().getOwner() == null) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.sequencer.error.noOwner.title"),
|
||||
I18N.localise("genetics.machine.sequencer.error.noOwner")
|
||||
);
|
||||
}
|
||||
if (getUtil().getSlotCharge(Sequencer.SLOT_DYE_INDEX) == 0.0f) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.sequencer.error.noDye"),
|
||||
Sequencer.SLOT_DYE_INDEX
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (getMachine().getOwner() == null) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.sequencer.error.noOwner.title"),
|
||||
I18N.localise("genetics.machine.sequencer.error.noOwner"));
|
||||
}
|
||||
if (getUtil().getSlotCharge(Sequencer.SLOT_DYE_INDEX) == 0.0f) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.sequencer.error.noDye"), Sequencer.SLOT_DYE_INDEX);
|
||||
}
|
||||
|
||||
ItemStack stack = getUtil().getStack(Sequencer.SLOT_DONE_INDEX);
|
||||
if (stack != null && stack.stackSize >= 64) {
|
||||
return new ErrorState.NoSpace(
|
||||
I18N.localise("genetics.machine.sequencer.error.noSpace"),
|
||||
Sequencer.SLOT_DONE_INDEX
|
||||
);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
ItemStack stack = getUtil().getStack(Sequencer.SLOT_DONE_INDEX);
|
||||
if (stack != null && stack.stackSize >= 64) {
|
||||
return new ErrorState.NoSpace(
|
||||
I18N.localise("genetics.machine.sequencer.error.noSpace"), Sequencer.SLOT_DONE_INDEX);
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestock(int target) {
|
||||
onStartTask();
|
||||
}
|
||||
@Override
|
||||
public void onRestock(int target) {
|
||||
onStartTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStartTask() {
|
||||
super.onStartTask();
|
||||
ItemStack item = getUtil().getStack(Sequencer.SLOT_TARGET_INDEX);
|
||||
SequencerItem seqItem = new SequencerItem(item);
|
||||
int seq = seqItem.sequenced;
|
||||
if (seq != 0) {
|
||||
setProgress(seq);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onStartTask() {
|
||||
super.onStartTask();
|
||||
ItemStack item = getUtil().getStack(Sequencer.SLOT_TARGET_INDEX);
|
||||
SequencerItem seqItem = new SequencerItem(item);
|
||||
int seq = seqItem.sequenced;
|
||||
if (seq != 0) {
|
||||
setProgress(seq);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
updateSequence();
|
||||
SequencerItem seqItem = new SequencerItem(getUtil().getStack(Sequencer.SLOT_TARGET_INDEX));
|
||||
GeneTracker.getTracker(getMachine().getWorld(), getMachine().getOwner()).registerGene(seqItem.getGene());
|
||||
getUtil().decreaseStack(Sequencer.SLOT_TARGET_INDEX, 1);
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
updateSequence();
|
||||
SequencerItem seqItem = new SequencerItem(getUtil().getStack(Sequencer.SLOT_TARGET_INDEX));
|
||||
GeneTracker.getTracker(getMachine().getWorld(), getMachine().getOwner()).registerGene(seqItem.getGene());
|
||||
getUtil().decreaseStack(Sequencer.SLOT_TARGET_INDEX, 1);
|
||||
|
||||
if (getUtil().getStack(Sequencer.SLOT_DONE_INDEX) == null) {
|
||||
getUtil().setStack(Sequencer.SLOT_DONE_INDEX, GeneticsItems.EmptySequencer.get(1));
|
||||
} else {
|
||||
getUtil().decreaseStack(Sequencer.SLOT_DONE_INDEX, -1);
|
||||
}
|
||||
}
|
||||
if (getUtil().getStack(Sequencer.SLOT_DONE_INDEX) == null) {
|
||||
getUtil().setStack(Sequencer.SLOT_DONE_INDEX, GeneticsItems.EmptySequencer.get(1));
|
||||
} else {
|
||||
getUtil().decreaseStack(Sequencer.SLOT_DONE_INDEX, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
updateSequence();
|
||||
getUtil().useCharge(Sequencer.SLOT_DYE_INDEX, 0.4f * getProgressPerTick() / 100.0f);
|
||||
}
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
updateSequence();
|
||||
getUtil().useCharge(Sequencer.SLOT_DYE_INDEX, 0.4f * getProgressPerTick() / 100.0f);
|
||||
}
|
||||
|
||||
private void updateSequence() {
|
||||
int prog = (int) getProgress();
|
||||
ItemStack item = getUtil().getStack(Sequencer.SLOT_TARGET_INDEX);
|
||||
SequencerItem seqItem = new SequencerItem(item);
|
||||
int seq = seqItem.sequenced;
|
||||
if (prog != seq) {
|
||||
seqItem.sequenced = prog;
|
||||
seqItem.writeToItem(item);
|
||||
}
|
||||
}
|
||||
private void updateSequence() {
|
||||
int prog = (int) getProgress();
|
||||
ItemStack item = getUtil().getStack(Sequencer.SLOT_TARGET_INDEX);
|
||||
SequencerItem seqItem = new SequencerItem(item);
|
||||
int seq = seqItem.sequenced;
|
||||
if (prog != seq) {
|
||||
seqItem.sequenced = prog;
|
||||
seqItem.writeToItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,50 +20,50 @@ import binnie.genetics.machine.PackageGeneticBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class SequencerPackage extends PackageGeneticBase implements IMachineInformation {
|
||||
public SequencerPackage() {
|
||||
super("sequencer", GeneticsTexture.Sequencer, 0xb7ff32, true);
|
||||
Sequencer.fxSeqA = Binnie.Resource.getBlockIcon(Genetics.instance, "fx/sequencer.a");
|
||||
Sequencer.fxSeqG = Binnie.Resource.getBlockIcon(Genetics.instance, "fx/sequencer.g");
|
||||
Sequencer.fxSeqT = Binnie.Resource.getBlockIcon(Genetics.instance, "fx/sequencer.t");
|
||||
Sequencer.fxSeqC = Binnie.Resource.getBlockIcon(Genetics.instance, "fx/sequencer.c");
|
||||
}
|
||||
public SequencerPackage() {
|
||||
super("sequencer", GeneticsTexture.Sequencer, 0xb7ff32, true);
|
||||
Sequencer.fxSeqA = Binnie.Resource.getBlockIcon(Genetics.instance, "fx/sequencer.a");
|
||||
Sequencer.fxSeqG = Binnie.Resource.getBlockIcon(Genetics.instance, "fx/sequencer.g");
|
||||
Sequencer.fxSeqT = Binnie.Resource.getBlockIcon(Genetics.instance, "fx/sequencer.t");
|
||||
Sequencer.fxSeqC = Binnie.Resource.getBlockIcon(Genetics.instance, "fx/sequencer.c");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Sequencer);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Sequencer);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
|
||||
InventorySlot slotDye = inventory.addSlot(Sequencer.SLOT_DYE_INDEX, "dye");
|
||||
slotDye.setValidator(new SlotValidator.Item(GeneticsItems.FluorescentDye.get(1), ModuleMachine.IconDye));
|
||||
slotDye.forbidExtraction();
|
||||
InventorySlot slotDye = inventory.addSlot(Sequencer.SLOT_DYE_INDEX, "dye");
|
||||
slotDye.setValidator(new SlotValidator.Item(GeneticsItems.FluorescentDye.get(1), ModuleMachine.IconDye));
|
||||
slotDye.forbidExtraction();
|
||||
|
||||
inventory.addSlotArray(Sequencer.SLOT_RESERVE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Sequencer.SLOT_RESERVE)) {
|
||||
slot.setValidator(new UnsequencedSlotValidator());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
inventory.addSlotArray(Sequencer.SLOT_RESERVE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Sequencer.SLOT_RESERVE)) {
|
||||
slot.setValidator(new UnsequencedSlotValidator());
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
InventorySlot slotTarget = inventory.addSlot(Sequencer.SLOT_TARGET_INDEX, "process");
|
||||
slotTarget.setValidator(new UnsequencedSlotValidator());
|
||||
slotTarget.setReadOnly();
|
||||
slotTarget.forbidInteraction();
|
||||
InventorySlot slotTarget = inventory.addSlot(Sequencer.SLOT_TARGET_INDEX, "process");
|
||||
slotTarget.setValidator(new UnsequencedSlotValidator());
|
||||
slotTarget.setReadOnly();
|
||||
slotTarget.forbidInteraction();
|
||||
|
||||
InventorySlot slotDone = inventory.addSlot(Sequencer.SLOT_DONE_INDEX, "output");
|
||||
slotDone.setReadOnly();
|
||||
InventorySlot slotDone = inventory.addSlot(Sequencer.SLOT_DONE_INDEX, "output");
|
||||
slotDone.setReadOnly();
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Sequencer.SLOT_RESERVE, Sequencer.SLOT_TARGET_INDEX, 1);
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Sequencer.SLOT_RESERVE, Sequencer.SLOT_TARGET_INDEX, 1);
|
||||
|
||||
new ComponentChargedSlots(machine).addCharge(Sequencer.SLOT_DYE_INDEX);
|
||||
new ComponentPowerReceptor(machine, Sequencer.POWER_CAPACITY);
|
||||
new SequencerComponentFX(machine);
|
||||
new ComponentChargedSlots(machine).addCharge(Sequencer.SLOT_DYE_INDEX);
|
||||
new ComponentPowerReceptor(machine, Sequencer.POWER_CAPACITY);
|
||||
new SequencerComponentFX(machine);
|
||||
|
||||
SequencerComponentLogic logic = new SequencerComponentLogic(machine);
|
||||
transfer.setTransferListener(logic);
|
||||
}
|
||||
SequencerComponentLogic logic = new SequencerComponentLogic(machine);
|
||||
transfer.setTransferListener(logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
@@ -8,21 +8,21 @@ import binnie.genetics.machine.ModuleMachine;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class UnsequencedSlotValidator extends SlotValidator {
|
||||
public UnsequencedSlotValidator() {
|
||||
super(ModuleMachine.IconSequencer);
|
||||
}
|
||||
public UnsequencedSlotValidator() {
|
||||
super(ModuleMachine.IconSequencer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
if (itemStack.getItem() == Genetics.itemSequencer) {
|
||||
SequencerItem seq = new SequencerItem(itemStack);
|
||||
return seq.sequenced < 100;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
if (itemStack.getItem() == Genetics.itemSequencer) {
|
||||
SequencerItem seq = new SequencerItem(itemStack);
|
||||
return seq.sequenced < 100;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.sequencer.unsequencedDNA");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.sequencer.unsequencedDNA");
|
||||
}
|
||||
}
|
||||
@@ -8,18 +8,18 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class IndividualInoculateValidator extends SlotValidator {
|
||||
public IndividualInoculateValidator() {
|
||||
super(null);
|
||||
}
|
||||
public IndividualInoculateValidator() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack object) {
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(object);
|
||||
return root != null && Binnie.Genetics.getSystem(root).isDNAManipulable(object);
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(ItemStack object) {
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(object);
|
||||
return root != null && Binnie.Genetics.getSystem(root).isDNAManipulable(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.splicer.splicableIndividual");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.splicer.splicableIndividual");
|
||||
}
|
||||
}
|
||||
@@ -7,17 +7,17 @@ import binnie.genetics.machine.ModuleMachine;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
class SerumSlotValidator extends SlotValidator {
|
||||
public SerumSlotValidator() {
|
||||
super(ModuleMachine.IconSerum);
|
||||
}
|
||||
public SerumSlotValidator() {
|
||||
super(ModuleMachine.IconSerum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return itemStack.getItem() instanceof IItemSerum;
|
||||
}
|
||||
@Override
|
||||
public boolean isValid(ItemStack itemStack) {
|
||||
return itemStack.getItem() instanceof IItemSerum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.splicer.serums");
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18N.localise("genetics.machine.splicer.serums");
|
||||
}
|
||||
}
|
||||
@@ -9,32 +9,32 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class Splicer {
|
||||
public static final int SLOT_SERUM_VIAL = 0;
|
||||
public static final int[] SLOT_SERUM_RESERVE = new int[]{1, 2};
|
||||
public static final int[] SLOT_SERUM_EXPENDED = new int[]{3, 4};
|
||||
public static final int[] SLOT_RESERVE = new int[]{5, 6, 7, 8, 9};
|
||||
public static final int SLOT_TARGET = 9;
|
||||
public static final int[] SLOT_FINISHED = new int[]{10, 11, 12, 13};
|
||||
public static final int RF_COST = 12000000;
|
||||
public static final int TIME_PERIOD = 1200;
|
||||
public static final int POWER_CAPACITY = 20000;
|
||||
public static final int SLOT_SERUM_VIAL = 0;
|
||||
public static final int[] SLOT_SERUM_RESERVE = new int[] {1, 2};
|
||||
public static final int[] SLOT_SERUM_EXPENDED = new int[] {3, 4};
|
||||
public static final int[] SLOT_RESERVE = new int[] {5, 6, 7, 8, 9};
|
||||
public static final int SLOT_TARGET = 9;
|
||||
public static final int[] SLOT_FINISHED = new int[] {10, 11, 12, 13};
|
||||
public static final int RF_COST = 12000000;
|
||||
public static final int TIME_PERIOD = 1200;
|
||||
public static final int POWER_CAPACITY = 20000;
|
||||
|
||||
public static void setGene(IGene gene, ItemStack target, int chromoN) {
|
||||
int chromosomeID = gene.getChromosome().ordinal();
|
||||
if (chromosomeID >= EnumBeeChromosome.HUMIDITY.ordinal() && gene.getSpeciesRoot() instanceof IBeeRoot) {
|
||||
chromosomeID--;
|
||||
}
|
||||
public static void setGene(IGene gene, ItemStack target, int chromoN) {
|
||||
int chromosomeID = gene.getChromosome().ordinal();
|
||||
if (chromosomeID >= EnumBeeChromosome.HUMIDITY.ordinal() && gene.getSpeciesRoot() instanceof IBeeRoot) {
|
||||
chromosomeID--;
|
||||
}
|
||||
|
||||
Class<? extends IAllele> cls = gene.getChromosome().getAlleleClass();
|
||||
if (!cls.isInstance(gene.getAllele())) {
|
||||
return;
|
||||
}
|
||||
Class<? extends IAllele> cls = gene.getChromosome().getAlleleClass();
|
||||
if (!cls.isInstance(gene.getAllele())) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound beeNBT = target.getTagCompound();
|
||||
NBTTagCompound genomeNBT = beeNBT.getCompoundTag("Genome");
|
||||
NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
|
||||
NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
|
||||
chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID());
|
||||
target.setTagCompound(beeNBT);
|
||||
}
|
||||
NBTTagCompound beeNBT = target.getTagCompound();
|
||||
NBTTagCompound genomeNBT = beeNBT.getCompoundTag("Genome");
|
||||
NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
|
||||
NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
|
||||
chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID());
|
||||
target.setTagCompound(beeNBT);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -15,116 +16,113 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Random;
|
||||
public class SplicerComponentFX extends MachineComponent
|
||||
implements IRender.RandomDisplayTick, IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync {
|
||||
private EntityItem dummyEntityItem;
|
||||
|
||||
public class SplicerComponentFX extends MachineComponent implements
|
||||
IRender.RandomDisplayTick,
|
||||
IRender.DisplayTick,
|
||||
IRender.Render,
|
||||
INetwork.TilePacketSync {
|
||||
private EntityItem dummyEntityItem;
|
||||
public SplicerComponentFX(IMachine machine) {
|
||||
super(machine);
|
||||
dummyEntityItem = new EntityItem(null);
|
||||
}
|
||||
|
||||
public SplicerComponentFX(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) {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
int tick = (int) (world.getTotalWorldTime() % 3L);
|
||||
if (tick != 0 || !getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
int tick = (int) (world.getTotalWorldTime() % 3L);
|
||||
if (tick != 0 || !getUtil().getProcess().isInProgress()) {
|
||||
return;
|
||||
}
|
||||
BinnieCore.proxy
|
||||
.getMinecraftInstance()
|
||||
.effectRenderer
|
||||
.addEffect(new EntityFX(world, x + 0.5, y + 1.5, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = (int) (worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
|
||||
|
||||
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1.5, z + 0.5, 0.0, 0.0, 0.0) {
|
||||
double axisX = posX;
|
||||
double axisZ = posZ;
|
||||
double angle = (int) (worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = (rand.nextDouble() - 0.5) * 0.02;
|
||||
particleMaxAge = 240;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.3f + rand.nextFloat() * 0.5f, 0.3f + rand.nextFloat() * 0.5f, 0.0f);
|
||||
}
|
||||
|
||||
{
|
||||
axisX = 0.0;
|
||||
axisZ = 0.0;
|
||||
angle = 0.0;
|
||||
motionX = 0.0;
|
||||
motionZ = 0.0;
|
||||
motionY = (rand.nextDouble() - 0.5) * 0.02;
|
||||
particleMaxAge = 240;
|
||||
particleGravity = 0.0f;
|
||||
noClip = true;
|
||||
setRBGColorF(0.3f + rand.nextFloat() * 0.5f, 0.3f + rand.nextFloat() * 0.5f, 0.0f);
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
double speed = 0.04;
|
||||
angle -= speed;
|
||||
double dist = 0.25 + 0.2 * Math.sin(particleAge / 50.0f);
|
||||
setPosition(axisX + dist * Math.sin(angle), posY, axisZ + dist * Math.cos(angle));
|
||||
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
double speed = 0.04;
|
||||
angle -= speed;
|
||||
double dist = 0.25 + 0.2 * Math.sin(particleAge / 50.0f);
|
||||
setPosition(axisX + dist * Math.sin(angle), posY, axisZ + dist * Math.cos(angle));
|
||||
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(Splicer.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(Splicer.SLOT_TARGET);
|
||||
dummyEntityItem.worldObj = getMachine().getWorld();
|
||||
dummyEntityItem.setEntityItemStack(stack);
|
||||
EntityItem dummyEntityItem = this.dummyEntityItem;
|
||||
dummyEntityItem.age++;
|
||||
this.dummyEntityItem.hoverStart = 0.0f;
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glTranslatef(0.0f, -0.25f, 0.0f);
|
||||
renderItem.doRender(this.dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glTranslatef(0.0f, -0.25f, 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(Splicer.SLOT_TARGET);
|
||||
if (stack != null) {
|
||||
stack.writeToNBT(item);
|
||||
nbt.setTag("item", item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToNBT(NBTTagCompound nbt) {
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
ItemStack stack = getUtil().getStack(Splicer.SLOT_TARGET);
|
||||
if (stack != null) {
|
||||
stack.writeToNBT(item);
|
||||
nbt.setTag("item", item);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
if (nbt.hasKey("item")) {
|
||||
getUtil().setStack(Splicer.SLOT_TARGET, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
|
||||
} else {
|
||||
getUtil().setStack(Splicer.SLOT_TARGET, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncFromNBT(NBTTagCompound nbt) {
|
||||
if (nbt.hasKey("item")) {
|
||||
getUtil().setStack(Splicer.SLOT_TARGET, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
|
||||
} else {
|
||||
getUtil().setStack(Splicer.SLOT_TARGET, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryUpdate() {
|
||||
if (!getUtil().isServer()) {
|
||||
return;
|
||||
}
|
||||
getUtil().refreshBlock();
|
||||
}
|
||||
@Override
|
||||
public void onInventoryUpdate() {
|
||||
if (!getUtil().isServer()) {
|
||||
return;
|
||||
}
|
||||
getUtil().refreshBlock();
|
||||
}
|
||||
}
|
||||
@@ -17,188 +17,179 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class SplicerComponentLogic extends ComponentProcessSetCost implements IProcess {
|
||||
public int nOfGenes;
|
||||
public int nOfGenes;
|
||||
|
||||
public SplicerComponentLogic(Machine machine) {
|
||||
super(machine, Splicer.RF_COST, Splicer.TIME_PERIOD);
|
||||
nOfGenes = 0;
|
||||
}
|
||||
public SplicerComponentLogic(Machine machine) {
|
||||
super(machine, Splicer.RF_COST, Splicer.TIME_PERIOD);
|
||||
nOfGenes = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
float n = getNumberOfGenes();
|
||||
if (n > 1.0f) {
|
||||
n = 1.0f + (n - 1.0f) * 0.5f;
|
||||
}
|
||||
// Fix for / by 0
|
||||
int temp = (int) (super.getProcessLength() * n);
|
||||
return temp != 0 ? temp : 1;
|
||||
}
|
||||
@Override
|
||||
public int getProcessLength() {
|
||||
float n = getNumberOfGenes();
|
||||
if (n > 1.0f) {
|
||||
n = 1.0f + (n - 1.0f) * 0.5f;
|
||||
}
|
||||
// Fix for / by 0
|
||||
int temp = (int) (super.getProcessLength() * n);
|
||||
return temp != 0 ? temp : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessEnergy() {
|
||||
float n = getNumberOfGenes();
|
||||
if (n > 1.0f) {
|
||||
n = 1.0f + (n - 1.0f) * 0.5f;
|
||||
}
|
||||
return (int) (super.getProcessEnergy() * n);
|
||||
}
|
||||
@Override
|
||||
public int getProcessEnergy() {
|
||||
float n = getNumberOfGenes();
|
||||
if (n > 1.0f) {
|
||||
n = 1.0f + (n - 1.0f) * 0.5f;
|
||||
}
|
||||
return (int) (super.getProcessEnergy() * n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryUpdate() {
|
||||
super.onInventoryUpdate();
|
||||
nOfGenes = getGenesToUse();
|
||||
}
|
||||
@Override
|
||||
public void onInventoryUpdate() {
|
||||
super.onInventoryUpdate();
|
||||
nOfGenes = getGenesToUse();
|
||||
}
|
||||
|
||||
protected int getGenesToUse() {
|
||||
ItemStack serum = getUtil().getStack(Splicer.SLOT_SERUM_VIAL);
|
||||
ItemStack target = getUtil().getStack(Splicer.SLOT_TARGET);
|
||||
if (serum == null || target == null) {
|
||||
return 1;
|
||||
}
|
||||
protected int getGenesToUse() {
|
||||
ItemStack serum = getUtil().getStack(Splicer.SLOT_SERUM_VIAL);
|
||||
ItemStack target = getUtil().getStack(Splicer.SLOT_TARGET);
|
||||
if (serum == null || target == null) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
|
||||
IGene[] genes = ((IItemSerum) serum.getItem()).getGenes(serum);
|
||||
if (ind.getGenome().getSpeciesRoot() != ((IItemSerum) serum.getItem()).getSpeciesRoot(serum)) {
|
||||
return 1;
|
||||
}
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
|
||||
IGene[] genes = ((IItemSerum) serum.getItem()).getGenes(serum);
|
||||
if (ind.getGenome().getSpeciesRoot() != ((IItemSerum) serum.getItem()).getSpeciesRoot(serum)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (IGene gene : genes) {
|
||||
if (ind.getGenome().getActiveAllele(gene.getChromosome()) != gene.getAllele() ||
|
||||
ind.getGenome().getInactiveAllele(gene.getChromosome()) != gene.getAllele()) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return (i < 1) ? 1 : i;
|
||||
}
|
||||
int i = 0;
|
||||
for (IGene gene : genes) {
|
||||
if (ind.getGenome().getActiveAllele(gene.getChromosome()) != gene.getAllele()
|
||||
|| ind.getGenome().getInactiveAllele(gene.getChromosome()) != gene.getAllele()) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return (i < 1) ? 1 : i;
|
||||
}
|
||||
|
||||
private int getFullNumberOfGenes() {
|
||||
ItemStack serum = getUtil().getStack(Splicer.SLOT_SERUM_VIAL);
|
||||
if (serum == null) {
|
||||
return 1;
|
||||
}
|
||||
return Engineering.getGenes(serum).length;
|
||||
}
|
||||
private int getFullNumberOfGenes() {
|
||||
ItemStack serum = getUtil().getStack(Splicer.SLOT_SERUM_VIAL);
|
||||
if (serum == null) {
|
||||
return 1;
|
||||
}
|
||||
return Engineering.getGenes(serum).length;
|
||||
}
|
||||
|
||||
private int getNumberOfGenes() {
|
||||
return nOfGenes;
|
||||
}
|
||||
private int getNumberOfGenes() {
|
||||
return nOfGenes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
int n = getNumberOfGenes();
|
||||
int f = getFullNumberOfGenes();
|
||||
if (f > 1) {
|
||||
if (n > 1) {
|
||||
return I18N.localise("genetics.machine.splicer.splicingIn.0", n, f);
|
||||
}
|
||||
return I18N.localise("genetics.machine.splicer.splicingIn.1", n, f);
|
||||
}
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
int n = getNumberOfGenes();
|
||||
int f = getFullNumberOfGenes();
|
||||
if (f > 1) {
|
||||
if (n > 1) {
|
||||
return I18N.localise("genetics.machine.splicer.splicingIn.0", n, f);
|
||||
}
|
||||
return I18N.localise("genetics.machine.splicer.splicingIn.1", n, f);
|
||||
}
|
||||
|
||||
if (n > 1) {
|
||||
return I18N.localise("genetics.machine.splicer.splicingIn.2", n);
|
||||
}
|
||||
return I18N.localise("genetics.machine.splicer.splicingIn.3", n);
|
||||
}
|
||||
if (n > 1) {
|
||||
return I18N.localise("genetics.machine.splicer.splicingIn.2", n);
|
||||
}
|
||||
return I18N.localise("genetics.machine.splicer.splicingIn.3", n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Splicer.SLOT_TARGET)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.splicer.error.noIndividual"),
|
||||
Splicer.SLOT_TARGET
|
||||
);
|
||||
}
|
||||
if (getUtil().isSlotEmpty(Splicer.SLOT_SERUM_VIAL)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.splicer.error.noSerum"),
|
||||
Splicer.SLOT_SERUM_VIAL
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
if (getUtil().isSlotEmpty(Splicer.SLOT_TARGET)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.splicer.error.noIndividual"), Splicer.SLOT_TARGET);
|
||||
}
|
||||
if (getUtil().isSlotEmpty(Splicer.SLOT_SERUM_VIAL)) {
|
||||
return new ErrorState.NoItem(
|
||||
I18N.localise("genetics.machine.splicer.error.noSerum"), Splicer.SLOT_SERUM_VIAL);
|
||||
}
|
||||
|
||||
ErrorState state = isValidSerum();
|
||||
if (state != null) {
|
||||
return state;
|
||||
}
|
||||
ErrorState state = isValidSerum();
|
||||
if (state != null) {
|
||||
return state;
|
||||
}
|
||||
|
||||
if (getUtil().getStack(0) != null && Engineering.getCharges(getUtil().getStack(Splicer.SLOT_SERUM_VIAL)) == 0) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.splicer.error.emptySerum.title"),
|
||||
I18N.localise("genetics.machine.splicer.error.emptySerum")
|
||||
);
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
if (getUtil().getStack(0) != null && Engineering.getCharges(getUtil().getStack(Splicer.SLOT_SERUM_VIAL)) == 0) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.splicer.error.emptySerum.title"),
|
||||
I18N.localise("genetics.machine.splicer.error.emptySerum"));
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
public ErrorState isValidSerum() {
|
||||
ItemStack serum = getUtil().getStack(Splicer.SLOT_SERUM_VIAL);
|
||||
ItemStack target = getUtil().getStack(Splicer.SLOT_TARGET);
|
||||
IGene[] genes = Engineering.getGenes(serum);
|
||||
if (genes.length == 0) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.splicer.error.invalidSerum.title"),
|
||||
I18N.localise("genetics.machine.splicer.error.invalidSerum.0")
|
||||
);
|
||||
}
|
||||
if (!genes[0].getSpeciesRoot().isMember(target)) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.splicer.error.invalidSerum.title"),
|
||||
I18N.localise("genetics.machine.splicer.error.invalidSerum.1")
|
||||
);
|
||||
}
|
||||
public ErrorState isValidSerum() {
|
||||
ItemStack serum = getUtil().getStack(Splicer.SLOT_SERUM_VIAL);
|
||||
ItemStack target = getUtil().getStack(Splicer.SLOT_TARGET);
|
||||
IGene[] genes = Engineering.getGenes(serum);
|
||||
if (genes.length == 0) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.splicer.error.invalidSerum.title"),
|
||||
I18N.localise("genetics.machine.splicer.error.invalidSerum.0"));
|
||||
}
|
||||
if (!genes[0].getSpeciesRoot().isMember(target)) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.splicer.error.invalidSerum.title"),
|
||||
I18N.localise("genetics.machine.splicer.error.invalidSerum.1"));
|
||||
}
|
||||
|
||||
IIndividual individual = genes[0].getSpeciesRoot().getMember(target);
|
||||
boolean hasAll = true;
|
||||
for (IGene gene : genes) {
|
||||
if (hasAll) {
|
||||
IGenome genome = individual.getGenome();
|
||||
IChromosomeType chromosome = gene.getChromosome();
|
||||
String geneAlleleUID = gene.getAllele().getUID();
|
||||
IAllele a = genome.getActiveAllele(chromosome);
|
||||
IAllele b = genome.getInactiveAllele(chromosome);
|
||||
hasAll = a.getUID().equals(geneAlleleUID)
|
||||
&& b.getUID().equals(geneAlleleUID);
|
||||
}
|
||||
}
|
||||
IIndividual individual = genes[0].getSpeciesRoot().getMember(target);
|
||||
boolean hasAll = true;
|
||||
for (IGene gene : genes) {
|
||||
if (hasAll) {
|
||||
IGenome genome = individual.getGenome();
|
||||
IChromosomeType chromosome = gene.getChromosome();
|
||||
String geneAlleleUID = gene.getAllele().getUID();
|
||||
IAllele a = genome.getActiveAllele(chromosome);
|
||||
IAllele b = genome.getInactiveAllele(chromosome);
|
||||
hasAll = a.getUID().equals(geneAlleleUID) && b.getUID().equals(geneAlleleUID);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasAll) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.splicer.error.defunctSerum.title"),
|
||||
I18N.localise("genetics.machine.splicer.error.defunctSerum")
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (hasAll) {
|
||||
return new ErrorState(
|
||||
I18N.localise("genetics.machine.splicer.error.defunctSerum.title"),
|
||||
I18N.localise("genetics.machine.splicer.error.defunctSerum"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
return super.canProgress();
|
||||
}
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
return super.canProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
ItemStack serum = getUtil().getStack(Splicer.SLOT_SERUM_VIAL);
|
||||
ItemStack target = getUtil().getStack(Splicer.SLOT_TARGET);
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
|
||||
if (!ind.isAnalyzed()) {
|
||||
ind.analyze();
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
ind.writeToNBT(nbttagcompound);
|
||||
target.setTagCompound(nbttagcompound);
|
||||
}
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
super.onFinishTask();
|
||||
ItemStack serum = getUtil().getStack(Splicer.SLOT_SERUM_VIAL);
|
||||
ItemStack target = getUtil().getStack(Splicer.SLOT_TARGET);
|
||||
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
|
||||
if (!ind.isAnalyzed()) {
|
||||
ind.analyze();
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
ind.writeToNBT(nbttagcompound);
|
||||
target.setTagCompound(nbttagcompound);
|
||||
}
|
||||
|
||||
IGene[] genes = ((IItemSerum) serum.getItem()).getGenes(serum);
|
||||
for (IGene gene : genes) {
|
||||
Splicer.setGene(gene, target, 0);
|
||||
Splicer.setGene(gene, target, 1);
|
||||
}
|
||||
getUtil().damageItem(Splicer.SLOT_SERUM_VIAL, 1);
|
||||
}
|
||||
IGene[] genes = ((IItemSerum) serum.getItem()).getGenes(serum);
|
||||
for (IGene gene : genes) {
|
||||
Splicer.setGene(gene, target, 0);
|
||||
Splicer.setGene(gene, target, 1);
|
||||
}
|
||||
getUtil().damageItem(Splicer.SLOT_SERUM_VIAL, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
protected void onTickTask() {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
@@ -17,76 +17,80 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class SplicerPackage extends AdvGeneticMachine.PackageAdvGeneticBase implements IMachineInformation {
|
||||
public SplicerPackage() {
|
||||
super("splicer", GeneticsTexture.Splicer, 0xe22235, true);
|
||||
}
|
||||
public SplicerPackage() {
|
||||
super("splicer", GeneticsTexture.Splicer, 0xe22235, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Splicer);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
SlotValidator serumValid = new SerumSlotValidator();
|
||||
@Override
|
||||
public void createMachine(Machine machine) {
|
||||
new ComponentGeneticGUI(machine, GeneticsGUI.Splicer);
|
||||
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
SlotValidator serumValid = new SerumSlotValidator();
|
||||
|
||||
InventorySlot serumSlot = inventory.addSlot(Splicer.SLOT_SERUM_VIAL, "serum.active");
|
||||
serumSlot.forbidInteraction();
|
||||
serumSlot.setReadOnly();
|
||||
serumSlot.setValidator(serumValid);
|
||||
InventorySlot serumSlot = inventory.addSlot(Splicer.SLOT_SERUM_VIAL, "serum.active");
|
||||
serumSlot.forbidInteraction();
|
||||
serumSlot.setReadOnly();
|
||||
serumSlot.setValidator(serumValid);
|
||||
|
||||
inventory.addSlotArray(Splicer.SLOT_SERUM_RESERVE, "serum.input");
|
||||
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_SERUM_RESERVE)) {
|
||||
slot.setValidator(serumValid);
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
inventory.addSlotArray(Splicer.SLOT_SERUM_RESERVE, "serum.input");
|
||||
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_SERUM_RESERVE)) {
|
||||
slot.setValidator(serumValid);
|
||||
slot.forbidExtraction();
|
||||
}
|
||||
|
||||
inventory.addSlotArray(Splicer.SLOT_SERUM_EXPENDED, "serum.output");
|
||||
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_SERUM_EXPENDED)) {
|
||||
slot.setValidator(serumValid);
|
||||
slot.setReadOnly();
|
||||
}
|
||||
inventory.addSlotArray(Splicer.SLOT_SERUM_EXPENDED, "serum.output");
|
||||
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_SERUM_EXPENDED)) {
|
||||
slot.setValidator(serumValid);
|
||||
slot.setReadOnly();
|
||||
}
|
||||
|
||||
inventory.addSlotArray(Splicer.SLOT_RESERVE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_RESERVE)) {
|
||||
slot.forbidExtraction();
|
||||
slot.setValidator(new IndividualInoculateValidator());
|
||||
}
|
||||
inventory.addSlotArray(Splicer.SLOT_RESERVE, "input");
|
||||
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_RESERVE)) {
|
||||
slot.forbidExtraction();
|
||||
slot.setValidator(new IndividualInoculateValidator());
|
||||
}
|
||||
|
||||
InventorySlot targetSlot = inventory.addSlot(Splicer.SLOT_TARGET, "process");
|
||||
targetSlot.setValidator(new IndividualInoculateValidator());
|
||||
targetSlot.setReadOnly();
|
||||
targetSlot.forbidInteraction();
|
||||
InventorySlot targetSlot = inventory.addSlot(Splicer.SLOT_TARGET, "process");
|
||||
targetSlot.setValidator(new IndividualInoculateValidator());
|
||||
targetSlot.setReadOnly();
|
||||
targetSlot.forbidInteraction();
|
||||
|
||||
inventory.addSlotArray(Splicer.SLOT_FINISHED, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_FINISHED)) {
|
||||
slot.setReadOnly();
|
||||
slot.forbidInsertion();
|
||||
slot.setValidator(new IndividualInoculateValidator());
|
||||
}
|
||||
inventory.addSlotArray(Splicer.SLOT_FINISHED, "output");
|
||||
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_FINISHED)) {
|
||||
slot.setReadOnly();
|
||||
slot.forbidInsertion();
|
||||
slot.setValidator(new IndividualInoculateValidator());
|
||||
}
|
||||
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Splicer.SLOT_RESERVE, Splicer.SLOT_TARGET, 1);
|
||||
transfer.addRestock(Splicer.SLOT_SERUM_RESERVE, Splicer.SLOT_SERUM_VIAL);
|
||||
transfer.addStorage(Splicer.SLOT_SERUM_VIAL, Splicer.SLOT_SERUM_EXPENDED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return Engineering.getCharges(stack) == 0;
|
||||
}
|
||||
});
|
||||
transfer.addStorage(Splicer.SLOT_TARGET, Splicer.SLOT_FINISHED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return stack != null
|
||||
&& transfer.getMachine().getMachineUtil().getStack(Splicer.SLOT_SERUM_VIAL) != null
|
||||
&& transfer.getMachine().getInterface(SplicerComponentLogic.class).isValidSerum() != null;
|
||||
}
|
||||
});
|
||||
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
|
||||
transfer.addRestock(Splicer.SLOT_RESERVE, Splicer.SLOT_TARGET, 1);
|
||||
transfer.addRestock(Splicer.SLOT_SERUM_RESERVE, Splicer.SLOT_SERUM_VIAL);
|
||||
transfer.addStorage(
|
||||
Splicer.SLOT_SERUM_VIAL, Splicer.SLOT_SERUM_EXPENDED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return Engineering.getCharges(stack) == 0;
|
||||
}
|
||||
});
|
||||
transfer.addStorage(Splicer.SLOT_TARGET, Splicer.SLOT_FINISHED, new ComponentInventoryTransfer.Condition() {
|
||||
@Override
|
||||
public boolean fufilled(ItemStack stack) {
|
||||
return stack != null
|
||||
&& transfer.getMachine().getMachineUtil().getStack(Splicer.SLOT_SERUM_VIAL) != null
|
||||
&& transfer.getMachine()
|
||||
.getInterface(SplicerComponentLogic.class)
|
||||
.isValidSerum()
|
||||
!= null;
|
||||
}
|
||||
});
|
||||
|
||||
new ComponentPowerReceptor(machine, Splicer.POWER_CAPACITY);
|
||||
new SplicerComponentLogic(machine);
|
||||
new SplicerComponentFX(machine);
|
||||
}
|
||||
new ComponentPowerReceptor(machine, Splicer.POWER_CAPACITY);
|
||||
new SplicerComponentLogic(machine);
|
||||
new SplicerComponentFX(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user