Improve code readability in binnie.genetics package

Drop unused (empty) method MachinePackage#register() from all classes
This commit is contained in:
kordum authored and mezz committed 2017-04-27 14:48:45 -07:00
1 parent 856f08b752
commit 730043ba9c
112 files changed
+4354 -4697

No files matched your search

@@ -1,77 +1,76 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import binnie.Binnie;
import binnie.botany.api.EnumFlowerChromosome;
import binnie.botany.gardening.Gardening;
import binnie.core.BinnieCore;
import binnie.core.Mods;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.genetics.Gene;
import java.util.Random;
import binnie.core.genetics.Tolerance;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.TileEntityMachine;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.power.ComponentProcessIndefinate;
import binnie.core.machines.power.ErrorState;
import binnie.genetics.core.GeneticsGUI;
import binnie.genetics.core.GeneticsTexture;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IAlleleTolerance;
import binnie.botany.gardening.Gardening;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.ComponentProcessIndefinate;
import binnie.core.machines.TileEntityMachine;
import net.minecraft.tileentity.TileEntity;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.IMachine;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.genetics.core.GeneticsGUI;
import binnie.core.machines.Machine;
import binnie.genetics.core.GeneticsTexture;
import binnie.core.craftgui.minecraft.IMachineInformation;
import java.util.HashMap;
import java.util.ArrayList;
import forestry.api.genetics.EnumTolerance;
import binnie.core.genetics.Tolerance;
import binnie.core.Mods;
import forestry.api.genetics.ISpeciesRoot;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import binnie.botany.api.EnumFlowerChromosome;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import forestry.api.apiculture.EnumBeeChromosome;
import binnie.Binnie;
import binnie.core.BinnieCore;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.ISpeciesRoot;
import forestry.api.genetics.AlleleManager;
import net.minecraft.item.ItemStack;
import java.util.Map;
import net.minecraft.tileentity.TileEntity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class Acclimatiser
{
public static final int[] slotReserve;
public static final int slotTarget = 4;
public static final int[] slotAcclimatiser;
public static final int[] slotDone;
private static List<ToleranceSystem> toleranceSystems;
static Map<ItemStack, Float> temperatureItems;
static Map<ItemStack, Float> humidityItems;
public class Acclimatiser {
public static int[] slotReserve = new int[]{0, 1, 2, 3};
public static int[] slotAcclimatiser = new int[]{5, 6, 7};
public static int[] slotDone = new int[]{8, 9, 10, 11};
public static int slotTarget = 4;
private static ToleranceSystem getToleranceSystem(final ItemStack stack, final ItemStack acclim) {
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
protected static Map<ItemStack, Float> temperatureItems = new HashMap<>();
protected static Map<ItemStack, Float> humidityItems = new HashMap<>();
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;
}
for (final ToleranceSystem system : Acclimatiser.toleranceSystems) {
if (root.getUID() == system.uid && system.type.hasEffect(acclim)) {
for (ToleranceSystem system : Acclimatiser.toleranceSystems) {
if (root.getUID().equals(system.uid) && system.type.hasEffect(acclim)) {
return system;
}
}
return null;
}
public static void addTolerance(final String uid, final IChromosomeType chromosome, final ToleranceType type) {
public static void addTolerance(String uid, IChromosomeType chromosome, ToleranceType type) {
Acclimatiser.toleranceSystems.add(new ToleranceSystem(uid, chromosome, type));
}
public static float getTemperatureEffect(final ItemStack item) {
for (final ItemStack stack : Acclimatiser.temperatureItems.keySet()) {
public static float getTemperatureEffect(ItemStack item) {
for (ItemStack stack : Acclimatiser.temperatureItems.keySet()) {
if (stack.isItemEqual(item)) {
return Acclimatiser.temperatureItems.get(stack);
}
@@ -79,8 +78,8 @@ public class Acclimatiser
return 0.0f;
}
public static float getHumidityEffect(final ItemStack item) {
for (final ItemStack stack : Acclimatiser.humidityItems.keySet()) {
public static float getHumidityEffect(ItemStack item) {
for (ItemStack stack : Acclimatiser.humidityItems.keySet()) {
if (stack.isItemEqual(item)) {
return Acclimatiser.humidityItems.get(stack);
}
@@ -88,18 +87,18 @@ public class Acclimatiser
return 0.0f;
}
public static void addTemperatureItem(final ItemStack itemstack, final float amount) {
if (itemstack == null) {
public static void addTemperatureItem(ItemStack itemStack, float amount) {
if (itemStack == null) {
return;
}
Acclimatiser.temperatureItems.put(itemstack, amount);
Acclimatiser.temperatureItems.put(itemStack, amount);
}
public static void addHumidityItem(final ItemStack itemstack, final float amount) {
if (itemstack == null) {
public static void addHumidityItem(ItemStack itemStack, float amount) {
if (itemStack == null) {
return;
}
Acclimatiser.humidityItems.put(itemstack, amount);
Acclimatiser.humidityItems.put(itemStack, amount);
}
public static void setupRecipes() {
@@ -107,15 +106,18 @@ public class Acclimatiser
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.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);
@@ -130,11 +132,12 @@ public class Acclimatiser
addHumidityItem(Mods.Forestry.stack("waxCapsuleWater"), 0.75f);
}
public static boolean canAcclimatise(final ItemStack stack, final List<ItemStack> acclimatisers) {
public static boolean canAcclimatise(ItemStack stack, List<ItemStack> acclimatisers) {
if (stack == null || acclimatisers.isEmpty()) {
return true;
}
for (final ItemStack acclim : acclimatisers) {
for (ItemStack acclim : acclimatisers) {
if (canAcclimatise(stack, acclim)) {
return true;
}
@@ -142,86 +145,114 @@ public class Acclimatiser
return false;
}
public static boolean canAcclimatise(final ItemStack stack, final ItemStack acclim) {
final ToleranceSystem system = getToleranceSystem(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(final ItemStack stack, final ItemStack acc) {
final ToleranceSystem system = getToleranceSystem(stack, acc);
public static ItemStack acclimatise(ItemStack stack, ItemStack acc) {
ToleranceSystem system = getToleranceSystem(stack, acc);
return system.alter(stack, acc);
}
public static Tolerance alterTolerance(final Tolerance tol, final float effect) {
final int[] is = tol.getBounds();
int[] range = new int[2];
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 };
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;
}
final EnumTolerance[] up = { EnumTolerance.NONE, EnumTolerance.UP_1, EnumTolerance.UP_2, EnumTolerance.UP_3, EnumTolerance.UP_4, EnumTolerance.UP_5 };
final EnumTolerance[] down = { EnumTolerance.NONE, EnumTolerance.DOWN_1, EnumTolerance.DOWN_2, EnumTolerance.DOWN_3, EnumTolerance.DOWN_4, EnumTolerance.DOWN_5 };
final 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]]);
}
final int avg = (int) ((-range[0] + range[1]) / 2.0f + 0.6f);
int avg = (int) ((-range[0] + range[1]) / 2.0f + 0.6f);
return Tolerance.get(both[avg]);
}
static {
slotReserve = new int[] { 0, 1, 2, 3 };
slotAcclimatiser = new int[] { 5, 6, 7 };
slotDone = new int[] { 8, 9, 10, 11 };
Acclimatiser.toleranceSystems = new ArrayList<ToleranceSystem>();
Acclimatiser.temperatureItems = new HashMap<ItemStack, Float>();
Acclimatiser.humidityItems = new HashMap<ItemStack, Float>();
public enum ToleranceType {
Temperature,
Humidity,
PH;
public float getEffect(ItemStack stack) {
switch (this) {
case Temperature:
return Acclimatiser.getTemperatureEffect(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);
}
break;
}
return 0.0f;
}
public boolean hasEffect(ItemStack stack) {
return getEffect(stack) != 0.0f;
}
}
public static class PackageAcclimatiser extends GeneticMachine.PackageGeneticBase implements IMachineInformation
{
public static class PackageAcclimatiser extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
public PackageAcclimatiser() {
super("acclimatiser", GeneticsTexture.Acclimatiser, 9857609, true);
super("acclimatiser", GeneticsTexture.Acclimatiser, 0x966a49, true);
}
@Override
public void createMachine(final Machine machine) {
public void createMachine(Machine machine) {
new ComponentGeneticGUI(machine, GeneticsGUI.Acclimatiser);
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
inventory.addSlot(4, "process");
inventory.getSlot(4).setValidator(new SlotValidator.Individual());
inventory.getSlot(4).setReadOnly();
inventory.getSlot(4).forbidExtraction();
for (final InventorySlot slot : inventory.addSlotArray(Acclimatiser.slotReserve, "input")) {
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.slotReserve, "input")) {
slot.forbidExtraction();
slot.setValidator(new SlotValidator.Individual());
}
for (final InventorySlot slot : inventory.addSlotArray(Acclimatiser.slotDone, "output")) {
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.slotDone, "output")) {
slot.setReadOnly();
slot.setValidator(new SlotValidator.Individual());
}
for (final InventorySlot slot : inventory.addSlotArray(Acclimatiser.slotAcclimatiser, "acclimatiser")) {
for (InventorySlot slot : inventory.addSlotArray(Acclimatiser.slotAcclimatiser, "acclimatiser")) {
slot.setValidator(new ValidatorAcclimatiserItem());
}
final ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
transfer.addRestock(Acclimatiser.slotReserve, 4, 1);
transfer.addStorage(4, Acclimatiser.slotDone, new ComponentInventoryTransfer.Condition() {
@Override
public boolean fufilled(final ItemStack stack) {
public boolean fufilled(ItemStack stack) {
return !Acclimatiser.canAcclimatise(stack, machine.getMachineUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser));
}
});
new ComponentPowerReceptor(machine, 5000);
new ComponentAcclimatiserLogic(machine);
}
@@ -230,24 +261,19 @@ public class Acclimatiser
public TileEntity createTileEntity() {
return new TileEntityMachine(this);
}
@Override
public void register() {
}
}
public static class ComponentAcclimatiserLogic extends ComponentProcessIndefinate
{
public ComponentAcclimatiserLogic(final IMachine machine) {
public static class ComponentAcclimatiserLogic extends ComponentProcessIndefinate {
public ComponentAcclimatiserLogic(IMachine machine) {
super(machine, 2.0f);
}
@Override
public ErrorState canWork() {
if (this.getUtil().getStack(4) == null) {
if (getUtil().getStack(4) == null) {
return new ErrorState.NoItem("No Individual to Acclimatise", 4);
}
if (this.getUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser).isEmpty()) {
if (getUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser).isEmpty()) {
return new ErrorState.NoItem("No Acclimatising Items", Acclimatiser.slotAcclimatiser);
}
return super.canWork();
@@ -255,7 +281,7 @@ public class Acclimatiser
@Override
public ErrorState canProgress() {
if (!Acclimatiser.canAcclimatise(this.getUtil().getStack(4), this.getUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser))) {
if (!Acclimatiser.canAcclimatise(getUtil().getStack(4), getUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser))) {
return new ErrorState.InvalidItem("Cannot Acclimatise this individual with these items", 4);
}
return super.canProgress();
@@ -263,32 +289,33 @@ public class Acclimatiser
@Override
protected boolean inProgress() {
return this.canWork() == null;
return canWork() == null;
}
@Override
protected void onTickTask() {
super.onTickTask();
if (this.getUtil().getRandom().nextInt(100) == 0) {
this.attemptAcclimatisation();
if (getUtil().getRandom().nextInt(100) == 0) {
attemptAcclimatisation();
}
}
protected void attemptAcclimatisation() {
final List<ItemStack> acclms = new ArrayList<ItemStack>();
for (final ItemStack s : this.getUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser)) {
if (Acclimatiser.canAcclimatise(this.getUtil().getStack(4), s)) {
List<ItemStack> acclms = new ArrayList<ItemStack>();
for (ItemStack s : getUtil().getNonNullStacks(Acclimatiser.slotAcclimatiser)) {
if (Acclimatiser.canAcclimatise(getUtil().getStack(4), s)) {
acclms.add(s);
}
}
final ItemStack acc = acclms.get(this.getUtil().getRandom().nextInt(acclms.size()));
final ItemStack acclimed = Acclimatiser.acclimatise(this.getUtil().getStack(4), acc);
ItemStack acc = acclms.get(getUtil().getRandom().nextInt(acclms.size()));
ItemStack acclimed = Acclimatiser.acclimatise(getUtil().getStack(4), acc);
if (acclimed != null) {
this.getUtil().setStack(4, acclimed);
getUtil().setStack(4, acclimed);
boolean removed = false;
for (final int i : Acclimatiser.slotAcclimatiser) {
if (!removed && this.getUtil().getStack(i) != null && this.getUtil().getStack(i).isItemEqual(acc)) {
this.getUtil().decreaseStack(i, 1);
for (int i : Acclimatiser.slotAcclimatiser) {
if (!removed && getUtil().getStack(i) != null && getUtil().getStack(i).isItemEqual(acc)) {
getUtil().decreaseStack(i, 1);
removed = true;
}
}
@@ -296,15 +323,14 @@ public class Acclimatiser
}
}
public static class ValidatorAcclimatiserItem extends SlotValidator
{
public static class ValidatorAcclimatiserItem extends SlotValidator {
public ValidatorAcclimatiserItem() {
super(null);
}
@Override
public boolean isValid(final ItemStack stack) {
for (final ToleranceType type : ToleranceType.values()) {
public boolean isValid(ItemStack stack) {
for (ToleranceType type : ToleranceType.values()) {
if (type.hasEffect(stack)) {
return true;
}
@@ -318,75 +344,43 @@ public class Acclimatiser
}
}
public enum ToleranceType
{
Temperature,
Humidity,
PH;
public float getEffect(final ItemStack stack) {
switch (this) {
case Temperature: {
return Acclimatiser.getTemperatureEffect(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);
}
break;
}
}
return 0.0f;
}
public boolean hasEffect(final ItemStack stack) {
return this.getEffect(stack) != 0.0f;
}
}
private static class ToleranceSystem
{
private static class ToleranceSystem {
String uid;
IChromosomeType chromosomeOrdinal;
ToleranceType type;
private ToleranceSystem(final String uid, final IChromosomeType chromosomeOrdinal, final ToleranceType type) {
private ToleranceSystem(String uid, IChromosomeType chromosomeOrdinal, ToleranceType type) {
this.uid = uid;
this.chromosomeOrdinal = chromosomeOrdinal;
this.type = type;
}
public boolean canAlter(final ItemStack stack, final ItemStack acclim) {
final IIndividual member = AlleleManager.alleleRegistry.getIndividual(stack);
final IGenome genome = member.getGenome();
final IAlleleTolerance tolAllele = (IAlleleTolerance) genome.getActiveAllele(this.chromosomeOrdinal);
final Tolerance tol = Tolerance.get(tolAllele.getValue());
final float effect = this.type.getEffect(acclim);
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(final ItemStack stack, final ItemStack acc) {
final Random rand = new Random();
final float effect = this.type.getEffect(acc);
public ItemStack alter(ItemStack stack, ItemStack acc) {
Random rand = new Random();
float effect = type.getEffect(acc);
if (rand.nextFloat() > Math.abs(effect)) {
return stack;
}
final IIndividual member = AlleleManager.alleleRegistry.getIndividual(stack);
final IGenome genome = member.getGenome();
final IAlleleTolerance tolAllele = (IAlleleTolerance) genome.getActiveAllele(this.chromosomeOrdinal);
final Tolerance tol = Tolerance.get(tolAllele.getValue());
final Tolerance newTol = Acclimatiser.alterTolerance(tol, effect);
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;
}
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
Inoculator.setGene(new Gene(newTol.getAllele(), this.chromosomeOrdinal, root), stack, rand.nextInt(2));
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
Inoculator.setGene(new Gene(newTol.getAllele(), chromosomeOrdinal, root), stack, rand.nextInt(2));
return stack;
}
}
@@ -1,29 +1,23 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import binnie.core.machines.IMachineType;
import binnie.core.machines.MachinePackage;
import binnie.core.resource.IBinnieTexture;
import net.minecraft.block.Block;
import binnie.genetics.Genetics;
import net.minecraft.item.ItemStack;
import binnie.core.machines.MachinePackage;
import binnie.core.machines.IMachineType;
public enum AdvGeneticMachine implements IMachineType
{
public enum AdvGeneticMachine implements IMachineType {
Splicer(Splicer.PackageSplicer.class);
Class<? extends MachinePackage> clss;
protected Class<? extends MachinePackage> cls;
private AdvGeneticMachine(final Class<? extends MachinePackage> clss) {
this.clss = clss;
AdvGeneticMachine(Class<? extends MachinePackage> cls) {
this.cls = cls;
}
@Override
public Class<? extends MachinePackage> getPackageClass() {
return this.clss;
return cls;
}
@Override
@@ -31,14 +25,13 @@ public enum AdvGeneticMachine implements IMachineType
return true;
}
public ItemStack get(final int i) {
return new ItemStack(Genetics.packageAdvGenetic.getBlock(), i, this.ordinal());
public ItemStack get(int i) {
return new ItemStack(Genetics.packageAdvGenetic.getBlock(), i, ordinal());
}
public abstract static class PackageAdvGeneticBase extends GeneticMachine.PackageGeneticBase
{
protected PackageAdvGeneticBase(final String uid, final IBinnieTexture renderTexture, final int flashColour, final boolean powered) {
super(uid, renderTexture, flashColour, powered);
public abstract static class PackageAdvGeneticBase extends GeneticMachine.PackageGeneticBase {
protected PackageAdvGeneticBase(String uid, IBinnieTexture renderTexture, int flashColor, boolean powered) {
super(uid, renderTexture, flashColor, powered);
}
}
}
@@ -1,61 +1,60 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import net.minecraft.entity.player.EntityPlayer;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.particle.EntityFX;
import binnie.Binnie;
import binnie.core.BinnieCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.entity.item.EntityItem;
import binnie.core.machines.network.INetwork;
import binnie.core.machines.component.IRender;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.TileEntityMachine;
import binnie.core.machines.component.IRender;
import binnie.core.machines.inventory.ComponentChargedSlots;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.network.INetwork;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.TileEntityMachine;
import net.minecraft.tileentity.TileEntity;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.inventory.ComponentChargedSlots;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.genetics.item.GeneticsItems;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.IMachine;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.genetics.core.GeneticsGUI;
import binnie.core.machines.Machine;
import binnie.genetics.core.GeneticsTexture;
import binnie.core.craftgui.minecraft.IMachineInformation;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.nbt.NBTTagCompound;
import forestry.api.genetics.IIndividual;
import binnie.Binnie;
import binnie.genetics.api.IItemAnalysable;
import binnie.genetics.core.GeneticsGUI;
import binnie.genetics.core.GeneticsTexture;
import binnie.genetics.item.GeneticsItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
public class Analyser
{
public static final int[] slotReserve;
public static final int slotTarget = 6;
public static final int[] slotFinished;
public static final int slotDye = 13;
import java.util.Random;
public static boolean isAnalysable(final ItemStack stack) {
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
public class Analyser {
public static int[] slotReserve = new int[]{0, 1, 2, 3, 4, 5};
public static int[] slotFinished = new int[]{7, 8, 9, 10, 11, 12};
public static int slotTarget = 6;
public static int slotDye = 13;
static {
}
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(final ItemStack stack) {
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
public static boolean isAnalysed(ItemStack stack) {
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
if (ind != null) {
return ind.isAnalyzed();
}
@@ -63,45 +62,42 @@ public class Analyser
}
public static ItemStack analyse(ItemStack stack) {
final ItemStack conv = Binnie.Genetics.getConversionStack(stack);
ItemStack conv = Binnie.Genetics.getConversionStack(stack);
if (conv != null) {
stack = conv;
}
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
if (root != null) {
final IIndividual ind = root.getMember(stack);
IIndividual ind = root.getMember(stack);
ind.analyze();
final NBTTagCompound nbttagcompound = new NBTTagCompound();
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;
}
static {
slotReserve = new int[] { 0, 1, 2, 3, 4, 5 };
slotFinished = new int[] { 7, 8, 9, 10, 11, 12 };
}
public static class PackageAnalyser extends GeneticMachine.PackageGeneticBase implements IMachineInformation
{
public static class PackageAnalyser extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
public PackageAnalyser() {
super("analyser", GeneticsTexture.Analyser, 9961727, true);
}
@Override
public void createMachine(final Machine machine) {
public void createMachine(Machine machine) {
new ComponentGeneticGUI(machine, GeneticsGUI.Analyser);
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
inventory.addSlotArray(Analyser.slotReserve, "input");
for (final InventorySlot slot : inventory.getSlots(Analyser.slotReserve)) {
for (InventorySlot slot : inventory.getSlots(Analyser.slotReserve)) {
slot.setValidator(new SlotValidatorUnanalysed());
slot.forbidExtraction();
}
inventory.addSlot(6, "analyse");
inventory.getSlot(6).setValidator(new SlotValidatorUnanalysed());
inventory.getSlot(6).setReadOnly();
@@ -110,7 +106,7 @@ public class Analyser
inventory.getSlot(13).forbidExtraction();
inventory.getSlot(13).setValidator(new SlotValidator(ModuleMachine.IconDye) {
@Override
public boolean isValid(final ItemStack itemStack) {
public boolean isValid(ItemStack itemStack) {
return itemStack.isItemEqual(GeneticsItems.DNADye.get(1));
}
@@ -119,19 +115,22 @@ public class Analyser
return "DNA Dye";
}
});
inventory.addSlotArray(Analyser.slotFinished, "output");
for (final InventorySlot slot : inventory.getSlots(Analyser.slotFinished)) {
for (InventorySlot slot : inventory.getSlots(Analyser.slotFinished)) {
slot.forbidInsertion();
slot.setReadOnly();
}
final ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
transfer.addRestock(Analyser.slotReserve, 6, 1);
transfer.addStorage(6, Analyser.slotFinished, new ComponentInventoryTransfer.Condition() {
@Override
public boolean fufilled(final ItemStack stack) {
public boolean fufilled(ItemStack stack) {
return Analyser.isAnalysed(stack);
}
});
new ComponentChargedSlots(machine).addCharge(13);
new ComponentPowerReceptor(machine, 500);
new ComponentAnalyserLogic(machine);
@@ -142,26 +141,22 @@ public class Analyser
public TileEntity createTileEntity() {
return new TileEntityMachine(this);
}
@Override
public void register() {
}
}
public static class ComponentAnalyserLogic extends ComponentProcessSetCost implements IProcess
{
private static final float DYE_PER_TICK = 0.002f;
public static class ComponentAnalyserLogic extends ComponentProcessSetCost implements IProcess {
private static float DYE_PER_TICK = 0.002f;
public ComponentAnalyserLogic(final Machine machine) {
public ComponentAnalyserLogic(Machine machine) {
super(machine, 9000, 300);
}
@Override
public ErrorState canWork() {
if (this.getUtil().isSlotEmpty(6)) {
if (getUtil().isSlotEmpty(6)) {
return new ErrorState.NoItem("No item to analyse", 6);
}
final boolean analysed = Analyser.isAnalysed(this.getUtil().getStack(6));
boolean analysed = Analyser.isAnalysed(getUtil().getStack(6));
if (analysed) {
return new ErrorState.InvalidItem("Already Analysed", "Item has already been analysed", 6);
}
@@ -170,8 +165,8 @@ public class Analyser
@Override
public ErrorState canProgress() {
if (this.getUtil().getSlotCharge(13) == 0.0f) {
return new ErrorState.Item("Insufficient Dye", "Not enough DNA dye to analyse", new int[] { 13 });
if (getUtil().getSlotCharge(13) == 0.0f) {
return new ErrorState.Item("Insufficient Dye", "Not enough DNA dye to analyse", new int[]{13});
}
return super.canProgress();
}
@@ -179,25 +174,24 @@ public class Analyser
@Override
protected void onFinishTask() {
super.onFinishTask();
ItemStack itemStack = this.getUtil().getStack(6);
ItemStack itemStack = getUtil().getStack(6);
itemStack = Analyser.analyse(itemStack);
this.getInventory().setInventorySlotContents(6, itemStack);
getInventory().setInventorySlotContents(6, itemStack);
}
@Override
protected void onTickTask() {
this.getUtil().useCharge(13, 0.002f);
getUtil().useCharge(13, 0.002f);
}
}
public static class SlotValidatorUnanalysed extends SlotValidator
{
public static class SlotValidatorUnanalysed extends SlotValidator {
public SlotValidatorUnanalysed() {
super(null);
}
@Override
public boolean isValid(final ItemStack itemStack) {
public boolean isValid(ItemStack itemStack) {
return Analyser.isAnalysable(itemStack) && !Analyser.isAnalysed(itemStack);
}
@@ -207,46 +201,50 @@ public class Analyser
}
}
public static class ComponentAnalyserFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync
{
private final EntityItem dummyEntityItem;
public static class ComponentAnalyserFX extends MachineComponent implements
IRender.RandomDisplayTick,
IRender.DisplayTick,
IRender.Render,
INetwork.TilePacketSync {
private EntityItem dummyEntityItem;
public ComponentAnalyserFX(final IMachine machine) {
public ComponentAnalyserFX(IMachine machine) {
super(machine);
this.dummyEntityItem = new EntityItem((World) null);
dummyEntityItem = new EntityItem(null);
}
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
// ignored
}
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
if (rand.nextFloat() < 1.0f && this.getUtil().getProcess().isInProgress()) {
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 = this.posX;
double axisZ = this.posZ;
double angle = this.rand.nextDouble() * 2.0 * 3.1415;
double axisX = posX;
double axisZ = posZ;
double angle = rand.nextDouble() * 2.0 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.05 * (this.rand.nextDouble() - 0.5);
this.motionZ = 0.05 * (this.rand.nextDouble() - 0.5);
this.motionY = 0.0;
this.particleMaxAge = 25;
this.particleGravity = 0.05f;
this.noClip = true;
this.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();
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
}
@Override
@@ -259,23 +257,25 @@ public class Analyser
@SideOnly(Side.CLIENT)
@Override
public void renderInWorld(final RenderItem renderItem, final double x, final double y, final double z) {
if (!this.getUtil().getProcess().isInProgress()) {
public void renderInWorld(RenderItem renderItem, double x, double y, double z) {
if (!getUtil().getProcess().isInProgress()) {
return;
}
final ItemStack stack = this.getUtil().getStack(6);
this.dummyEntityItem.worldObj = this.getMachine().getWorld();
this.dummyEntityItem.setEntityItemStack(stack);
final EntityItem dummyEntityItem = this.dummyEntityItem;
++dummyEntityItem.age;
ItemStack stack = getUtil().getStack(6);
dummyEntityItem.worldObj = getMachine().getWorld();
dummyEntityItem.setEntityItemStack(stack);
EntityItem dummyEntityItem = this.dummyEntityItem;
dummyEntityItem.age++;
this.dummyEntityItem.hoverStart = 0.0f;
if (stack == null) {
return;
}
final EntityPlayer player = BinnieCore.proxy.getPlayer();
final double dx = x + 0.5 - player.lastTickPosX;
final double dz = z + 0.5 - player.lastTickPosZ;
final double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
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);
@@ -284,30 +284,35 @@ public class Analyser
}
@Override
public void syncToNBT(final NBTTagCompound nbt) {
final NBTTagCompound item = new NBTTagCompound();
final ItemStack stack = this.getUtil().getStack(6);
if (stack != null) {
stack.writeToNBT(item);
nbt.setTag("item", item);
public void syncToNBT(NBTTagCompound nbt) {
NBTTagCompound item = new NBTTagCompound();
ItemStack stack = getUtil().getStack(6);
if (stack == null) {
return;
}
stack.writeToNBT(item);
nbt.setTag("item", item);
}
@Override
public void syncFromNBT(final NBTTagCompound nbt) {
public void syncFromNBT(NBTTagCompound nbt) {
if (nbt.hasKey("item")) {
this.getUtil().setStack(6, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
}
else {
this.getUtil().setStack(6, null);
getUtil().setStack(6, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
} else {
getUtil().setStack(6, null);
}
}
@Override
public void onInventoryUpdate() {
if (this.getUtil().isServer()) {
this.getMachine().getWorld().markBlockForUpdate(this.getMachine().getTileEntity().xCoord, this.getMachine().getTileEntity().yCoord, this.getMachine().getTileEntity().zCoord);
if (!getUtil().isServer()) {
return;
}
IMachine machine = getMachine();
TileEntity tile = machine.getTileEntity();
machine.getWorld().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
}
}
}
@@ -1,28 +1,23 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.component.IInteraction;
import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsGUI;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import binnie.core.machines.Machine;
import binnie.genetics.core.GeneticsGUI;
import binnie.core.machines.component.IInteraction;
import binnie.core.machines.MachineComponent;
public class ComponentGeneticGUI extends MachineComponent implements IInteraction.RightClick
{
public class ComponentGeneticGUI extends MachineComponent implements IInteraction.RightClick {
GeneticsGUI id;
public ComponentGeneticGUI(final Machine machine, final GeneticsGUI id) {
public ComponentGeneticGUI(Machine machine, GeneticsGUI id) {
super(machine);
this.id = id;
}
@Override
public void onRightClick(final World world, final EntityPlayer player, final int x, final int y, final int z) {
Genetics.proxy.openGui(this.id, player, x, y, z);
public void onRightClick(World world, EntityPlayer player, int x, int y, int z) {
Genetics.proxy.openGui(id, player, x, y, z);
}
}
@@ -1,89 +1,84 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import java.util.Map;
import binnie.Binnie;
import java.util.HashMap;
import java.util.ArrayList;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.machines.inventory.SetList;
import binnie.core.machines.Machine;
import net.minecraft.item.ItemStack;
import java.util.List;
import net.minecraft.inventory.IInventory;
import binnie.core.machines.inventory.ComponentInventory;
import binnie.core.machines.inventory.SetList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public abstract class ComponentIndexerInventory<T> extends ComponentInventory implements IInventory
{
int indexerSize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
// TODO unused class?
public abstract class ComponentIndexerInventory<T> extends ComponentInventory implements IInventory {
public int guiRefreshCounter;
List<ItemStack> indexerInventory;
public List<Integer> sortedInventory;
int indexerSize;
List<ItemStack> indexerInventory;
T sortingMode;
boolean needsSorting;
public ComponentIndexerInventory(final Machine machine) {
public ComponentIndexerInventory(Machine machine) {
super(machine);
this.indexerSize = -1;
this.guiRefreshCounter = 0;
this.indexerInventory = new SetList<ItemStack>();
this.sortedInventory = new SetList<Integer>();
this.needsSorting = true;
indexerSize = -1;
guiRefreshCounter = 0;
indexerInventory = new SetList<>();
sortedInventory = new SetList<>();
needsSorting = true;
}
@Override
public int getSizeInventory() {
if (this.indexerSize > 0) {
return this.indexerSize + 1;
if (indexerSize > 0) {
return indexerSize + 1;
}
return this.indexerInventory.size() + 1;
return indexerInventory.size() + 1;
}
@Override
public ItemStack getStackInSlot(final int index) {
if (index >= 0 && index < this.indexerInventory.size()) {
return this.indexerInventory.get(index);
public ItemStack getStackInSlot(int index) {
if (index >= 0 && index < indexerInventory.size()) {
return indexerInventory.get(index);
}
return null;
}
@Override
public ItemStack decrStackSize(final int index, final int amount) {
public ItemStack decrStackSize(int index, int amount) {
if (index >= 0) {
final ItemStack returnStack = this.getStackInSlot(index).copy();
this.setInventorySlotContents(index, null);
ItemStack returnStack = getStackInSlot(index).copy();
setInventorySlotContents(index, null);
return returnStack;
}
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(final int var1) {
public ItemStack getStackInSlotOnClosing(int var1) {
return null;
}
@Override
public void markDirty() {
super.markDirty();
++this.guiRefreshCounter;
guiRefreshCounter++;
}
@Override
public void setInventorySlotContents(final int index, final ItemStack itemStack) {
if (index >= 0 && index < this.indexerInventory.size()) {
this.indexerInventory.set(index, itemStack);
public void setInventorySlotContents(int index, ItemStack itemStack) {
if (index >= 0 && index < indexerInventory.size()) {
indexerInventory.set(index, itemStack);
} else if (itemStack != null) {
indexerInventory.add(itemStack);
}
else if (itemStack != null) {
this.indexerInventory.add(itemStack);
}
this.needsSorting = true;
this.markDirty();
needsSorting = true;
markDirty();
}
@Override
@@ -97,33 +92,35 @@ public abstract class ComponentIndexerInventory<T> extends ComponentInventory im
}
@Override
public boolean isUseableByPlayer(final EntityPlayer var1) {
public boolean isUseableByPlayer(EntityPlayer var1) {
return true;
}
@Override
public void openInventory() {
// ignored
}
@Override
public void closeInventory() {
}
public void setMode(final T mode) {
this.sortingMode = mode;
this.needsSorting = true;
// ignored
}
public T getMode() {
return this.sortingMode;
return sortingMode;
}
public void setMode(T mode) {
sortingMode = mode;
needsSorting = true;
}
@Override
public void writeToNBT(final NBTTagCompound nbttagcompound) {
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
final NBTTagList indexerNBT = new NBTTagList();
for (final ItemStack item : this.indexerInventory) {
final NBTTagCompound itemNBT = new NBTTagCompound();
NBTTagList indexerNBT = new NBTTagList();
for (ItemStack item : indexerInventory) {
NBTTagCompound itemNBT = new NBTTagCompound();
item.writeToNBT(itemNBT);
indexerNBT.appendTag(itemNBT);
}
@@ -131,124 +128,121 @@ public abstract class ComponentIndexerInventory<T> extends ComponentInventory im
}
@Override
public void readFromNBT(final NBTTagCompound nbttagcompound) {
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
final NBTTagList indexerNBT = nbttagcompound.getTagList("indexer", 10);
this.indexerInventory.clear();
NBTTagList indexerNBT = nbttagcompound.getTagList("indexer", 10);
indexerInventory.clear();
for (int i = 0; i < indexerNBT.tagCount(); ++i) {
final NBTTagCompound itemNBT = indexerNBT.getCompoundTagAt(i);
this.setInventorySlotContents(i, ItemStack.loadItemStackFromNBT(itemNBT));
NBTTagCompound itemNBT = indexerNBT.getCompoundTagAt(i);
setInventorySlotContents(i, ItemStack.loadItemStackFromNBT(itemNBT));
}
this.needsSorting = true;
this.markDirty();
needsSorting = true;
markDirty();
}
public abstract void Sort();
public static class ComponentApiaristIndexerInventory extends ComponentIndexerInventory<ComponentApiaristIndexerInventory.Mode> implements IInventory
{
public ComponentApiaristIndexerInventory(final Machine machine) {
public static class ComponentApiaristIndexerInventory extends ComponentIndexerInventory<ComponentApiaristIndexerInventory.Mode> implements IInventory {
public ComponentApiaristIndexerInventory(Machine machine) {
super(machine);
}
@Override
public void Sort() {
int i = 0;
while (i < this.indexerInventory.size()) {
if (this.indexerInventory.get(i) == null) {
this.indexerInventory.remove(i);
}
else {
while (i < indexerInventory.size()) {
if (indexerInventory.get(i) == null) {
indexerInventory.remove(i);
} else {
++i;
}
}
if (!this.needsSorting) {
if (!needsSorting) {
return;
}
this.needsSorting = false;
++this.guiRefreshCounter;
switch (this.sortingMode) {
case Species:
case Type: {
class SpeciesList
{
public List<Integer> drones;
public List<Integer> queens;
public List<Integer> princesses;
public List<ItemStack> bees;
SpeciesList() {
this.drones = new ArrayList<Integer>();
this.queens = new ArrayList<Integer>();
this.princesses = new ArrayList<Integer>();
this.bees = new ArrayList<ItemStack>();
}
public void add(final ItemStack stack) {
this.bees.add(stack);
}
}
final Map<Integer, SpeciesList> speciesList = new HashMap<Integer, SpeciesList>();
for (final ItemStack itemStack : this.indexerInventory) {
final int species = itemStack.getItemDamage();
if (!speciesList.containsKey(species)) {
speciesList.put(species, new SpeciesList());
}
speciesList.get(species).add(itemStack);
}
for (final SpeciesList sortableList : speciesList.values()) {
for (final ItemStack beeStack : sortableList.bees) {
if (Binnie.Genetics.getBeeRoot().isDrone(beeStack)) {
sortableList.drones.add(this.indexerInventory.indexOf(beeStack));
}
else if (Binnie.Genetics.getBeeRoot().isMated(beeStack)) {
sortableList.queens.add(this.indexerInventory.indexOf(beeStack));
}
else {
sortableList.princesses.add(this.indexerInventory.indexOf(beeStack));
}
}
}
this.sortedInventory = new SetList<Integer>();
switch (this.sortingMode) {
case Species: {
for (int j = 0; j < 1024; ++j) {
if (speciesList.containsKey(j)) {
this.sortedInventory.addAll(speciesList.get(j).queens);
this.sortedInventory.addAll(speciesList.get(j).princesses);
this.sortedInventory.addAll(speciesList.get(j).drones);
}
}
break;
}
needsSorting = false;
++guiRefreshCounter;
switch (sortingMode) {
case Species:
case Type: {
for (int j = 0; j < 1024; ++j) {
if (speciesList.containsKey(j)) {
this.sortedInventory.addAll(speciesList.get(j).queens);
class SpeciesList {
public List<Integer> drones;
public List<Integer> queens;
public List<Integer> princesses;
public List<ItemStack> bees;
SpeciesList() {
drones = new ArrayList<>();
queens = new ArrayList<>();
princesses = new ArrayList<>();
bees = new ArrayList<>();
}
public void add(ItemStack stack) {
bees.add(stack);
}
}
for (int j = 0; j < 1024; ++j) {
if (speciesList.containsKey(j)) {
this.sortedInventory.addAll(speciesList.get(j).princesses);
Map<Integer, SpeciesList> speciesList = new HashMap<Integer, SpeciesList>();
for (ItemStack itemStack : indexerInventory) {
int species = itemStack.getItemDamage();
if (!speciesList.containsKey(species)) {
speciesList.put(species, new SpeciesList());
}
speciesList.get(species).add(itemStack);
}
for (SpeciesList sortableList : speciesList.values()) {
for (ItemStack beeStack : sortableList.bees) {
if (Binnie.Genetics.getBeeRoot().isDrone(beeStack)) {
sortableList.drones.add(indexerInventory.indexOf(beeStack));
} else if (Binnie.Genetics.getBeeRoot().isMated(beeStack)) {
sortableList.queens.add(indexerInventory.indexOf(beeStack));
} else {
sortableList.princesses.add(indexerInventory.indexOf(beeStack));
}
}
}
for (int j = 0; j < 1024; ++j) {
if (speciesList.containsKey(j)) {
this.sortedInventory.addAll(speciesList.get(j).drones);
}
sortedInventory = new SetList<>();
switch (sortingMode) {
case Species:
for (int j = 0; j < 1024; ++j) {
if (speciesList.containsKey(j)) {
sortedInventory.addAll(speciesList.get(j).queens);
sortedInventory.addAll(speciesList.get(j).princesses);
sortedInventory.addAll(speciesList.get(j).drones);
}
}
break;
case Type:
for (int j = 0; j < 1024; ++j) {
if (speciesList.containsKey(j)) {
sortedInventory.addAll(speciesList.get(j).queens);
}
}
for (int j = 0; j < 1024; ++j) {
if (speciesList.containsKey(j)) {
sortedInventory.addAll(speciesList.get(j).princesses);
}
}
for (int j = 0; j < 1024; ++j) {
if (speciesList.containsKey(j)) {
sortedInventory.addAll(speciesList.get(j).drones);
}
}
break;
}
break;
}
default: {
sortedInventory.clear();
for (i = 0; i < indexerInventory.size(); ++i) {
sortedInventory.add(i);
}
break;
}
break;
}
default: {
this.sortedInventory.clear();
for (i = 0; i < this.indexerInventory.size(); ++i) {
this.sortedInventory.add(i);
}
break;
}
}
}
@@ -258,15 +252,14 @@ public abstract class ComponentIndexerInventory<T> extends ComponentInventory im
}
@Override
public boolean isItemValidForSlot(final int i, final ItemStack itemstack) {
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return true;
}
public static enum Mode
{
public enum Mode {
None,
Species,
Type;
Type
}
}
}
@@ -1,66 +1,61 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import net.minecraft.client.particle.EntityFX;
import binnie.core.BinnieCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.world.World;
import binnie.core.machines.component.IRender;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.inventory.IChargedSlots;
import forestry.api.genetics.ISpeciesRoot;
import binnie.Binnie;
import forestry.api.genetics.AlleleManager;
import net.minecraft.item.ItemStack;
import binnie.genetics.item.GeneticLiquid;
import binnie.core.BinnieCore;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.TileEntityMachine;
import binnie.core.machines.component.IRender;
import binnie.core.machines.inventory.ComponentChargedSlots;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.ComponentTankContainer;
import binnie.core.machines.inventory.IChargedSlots;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.inventory.TankValidator;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.TileEntityMachine;
import net.minecraft.tileentity.TileEntity;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.ComponentChargedSlots;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import net.minecraftforge.fluids.FluidStack;
import binnie.core.machines.inventory.TankValidator;
import binnie.core.machines.inventory.ComponentTankContainer;
import binnie.core.machines.inventory.SlotValidator;
import binnie.genetics.item.GeneticsItems;
import binnie.core.machines.IMachine;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.genetics.core.GeneticsGUI;
import binnie.core.machines.Machine;
import binnie.genetics.core.GeneticsTexture;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.genetics.item.GeneticLiquid;
import binnie.genetics.item.GeneticsItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
public class Genepool
{
public static final int slotBee = 0;
public static final int[] slotReserve;
public static final int tankDNA = 0;
public static final int tankEthanol = 1;
public static final int slotEnzyme = 7;
import java.util.Random;
public class Genepool {
public static int slotBee = 0;
public static int[] slotReserve;
public static int tankDNA = 0;
public static int tankEthanol = 1;
public static int slotEnzyme = 7;
static {
slotReserve = new int[] { 1, 2, 3, 4, 5, 6 };
slotReserve = new int[]{1, 2, 3, 4, 5, 6};
}
public static class PackageGenepool extends GeneticMachine.PackageGeneticBase implements IMachineInformation
{
public static class PackageGenepool extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
public PackageGenepool() {
super("genepool", GeneticsTexture.Genepool, 12661942, true);
super("genepool", GeneticsTexture.Genepool, 0xc134b6, true);
}
@Override
public void createMachine(final Machine machine) {
public void createMachine(Machine machine) {
new ComponentGeneticGUI(machine, GeneticsGUI.Genepool);
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
inventory.addSlot(7, "enzyme");
inventory.getSlot(7).setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.IconEnzyme));
inventory.getSlot(7).forbidExtraction();
@@ -69,11 +64,13 @@ public class Genepool
inventory.getSlot(0).setReadOnly();
inventory.getSlot(0).forbidExtraction();
inventory.addSlotArray(Genepool.slotReserve, "input");
for (final InventorySlot slot : inventory.getSlots(Genepool.slotReserve)) {
for (InventorySlot slot : inventory.getSlots(Genepool.slotReserve)) {
slot.setValidator(new SlotValidator.Individual());
slot.forbidExtraction();
}
final ComponentTankContainer tanks = new ComponentTankContainer(machine);
ComponentTankContainer tanks = new ComponentTankContainer(machine);
tanks.addTank(0, "output", 2000);
tanks.getTankSlot(0).setReadOnly();
tanks.addTank(1, "input", 1000);
@@ -85,15 +82,16 @@ public class Genepool
}
@Override
public boolean isValid(final FluidStack liquid) {
public boolean isValid(FluidStack liquid) {
return liquid.getFluid().getName() == "bioethanol";
}
});
final ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
transfer.addRestock(Genepool.slotReserve, 0, 1);
new ComponentPowerReceptor(machine, 1600);
new ComponentGenepoolLogic(machine);
final ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine);
ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine);
chargedSlots.addCharge(7);
new ComponentGenepoolFX(machine);
}
@@ -102,28 +100,23 @@ public class Genepool
public TileEntity createTileEntity() {
return new TileEntityMachine(this);
}
@Override
public void register() {
}
}
public static class ComponentGenepoolLogic extends ComponentProcessSetCost implements IProcess
{
public static class ComponentGenepoolLogic extends ComponentProcessSetCost implements IProcess {
float enzymePerProcess;
float ethanolPerProcess;
private float ethanolDrain;
public ComponentGenepoolLogic(final Machine machine) {
public ComponentGenepoolLogic(Machine machine) {
super(machine, 8000, 400);
this.enzymePerProcess = 0.25f;
this.ethanolPerProcess = 50.0f;
this.ethanolDrain = 0.0f;
enzymePerProcess = 0.25f;
ethanolPerProcess = 50.0f;
ethanolDrain = 0.0f;
}
@Override
public ErrorState canWork() {
if (this.getUtil().isSlotEmpty(0)) {
if (getUtil().isSlotEmpty(0)) {
return new ErrorState.NoItem("No Individual", 0);
}
return super.canWork();
@@ -131,13 +124,13 @@ public class Genepool
@Override
public ErrorState canProgress() {
if (!this.getUtil().spaceInTank(0, this.getDNAAmount(this.getUtil().getStack(0)))) {
return new ErrorState.NoSpace("Not enough room in Tank", new int[] { 0 });
if (!getUtil().spaceInTank(0, getDNAAmount(getUtil().getStack(0)))) {
return new ErrorState.NoSpace("Not enough room in Tank", new int[]{0});
}
if (!this.getUtil().liquidInTank(1, 1)) {
if (!getUtil().liquidInTank(1, 1)) {
return new ErrorState.InsufficientLiquid("Not enough Ethanol", 1);
}
if (this.getUtil().getSlotCharge(7) == 0.0f) {
if (getUtil().getSlotCharge(7) == 0.0f) {
return new ErrorState.NoItem("Insufficient Enzyme", 7);
}
return super.canProgress();
@@ -146,13 +139,13 @@ public class Genepool
@Override
protected void onFinishTask() {
super.onFinishTask();
final int amount = this.getDNAAmount(this.getUtil().getStack(0));
this.getUtil().fillTank(0, GeneticLiquid.RawDNA.get(amount));
this.getUtil().deleteStack(0);
int amount = getDNAAmount(getUtil().getStack(0));
getUtil().fillTank(0, GeneticLiquid.RawDNA.get(amount));
getUtil().deleteStack(0);
}
private int getDNAAmount(final ItemStack stack) {
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
private int getDNAAmount(ItemStack stack) {
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
if (root == null) {
return 10;
}
@@ -170,52 +163,52 @@ public class Genepool
@Override
protected void onTickTask() {
this.ethanolDrain += this.getDNAAmount(this.getUtil().getStack(0)) * 1.2f * this.getProgressPerTick() / 100.0f;
if (this.ethanolDrain >= 1.0f) {
this.getUtil().drainTank(1, 1);
--this.ethanolDrain;
ethanolDrain += getDNAAmount(getUtil().getStack(0)) * 1.2f * getProgressPerTick() / 100.0f;
if (ethanolDrain >= 1.0f) {
getUtil().drainTank(1, 1);
ethanolDrain--;
}
this.getMachine().getInterface(IChargedSlots.class).alterCharge(7, -this.enzymePerProcess * this.getProgressPerTick() / 100.0f);
getMachine().getInterface(IChargedSlots.class).alterCharge(7, -enzymePerProcess * getProgressPerTick() / 100.0f);
}
}
public static class ComponentGenepoolFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick
{
public ComponentGenepoolFX(final IMachine machine) {
public static class ComponentGenepoolFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
public ComponentGenepoolFX(IMachine machine) {
super(machine);
}
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
// ignored
}
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
if (rand.nextFloat() < 1.0f && this.getUtil().getProcess().isInProgress()) {
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.3 + rand.nextDouble() * 0.4, y + 1, z + 0.3 + rand.nextDouble() * 0.4, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = this.rand.nextDouble() * 2.0 * 3.1415;
double axisX = posX;
double axisZ = posZ;
double angle = rand.nextDouble() * 2.0 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = this.rand.nextFloat() * 0.01;
this.particleMaxAge = 25;
this.particleGravity = 0.0f;
this.noClip = true;
this.setRBGColorF(0.4f + 0.6f * this.rand.nextFloat(), 0.6f * this.rand.nextFloat(), 0.6f + 0.4f * this.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();
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
setAlphaF((float) Math.cos(1.57 * particleAge / particleMaxAge));
}
@Override
@@ -1,37 +1,31 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import net.minecraft.client.renderer.RenderBlocks;
import binnie.core.machines.Machine;
import binnie.core.machines.TileEntityMachine;
import net.minecraft.tileentity.TileEntity;
import binnie.core.resource.IBinnieTexture;
import binnie.core.resource.BinnieResource;
import net.minecraft.block.Block;
import binnie.genetics.Genetics;
import net.minecraft.item.ItemStack;
import binnie.core.machines.MachinePackage;
import binnie.core.machines.IMachineType;
import binnie.core.machines.Machine;
import binnie.core.machines.MachinePackage;
import binnie.core.machines.TileEntityMachine;
import binnie.core.resource.BinnieResource;
import binnie.core.resource.IBinnieTexture;
import binnie.genetics.Genetics;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
public enum GeneticMachine implements IMachineType
{
public enum GeneticMachine implements IMachineType {
Isolator(Isolator.PackageIsolator.class),
Sequencer(Sequencer.PackageSequencer.class),
Polymeriser(Polymeriser.PackagePolymeriser.class),
Inoculator(Inoculator.PackageInoculator.class);
Class<? extends MachinePackage> clss;
protected Class<? extends MachinePackage> clss;
private GeneticMachine(final Class<? extends MachinePackage> clss) {
GeneticMachine(Class<? extends MachinePackage> clss) {
this.clss = clss;
}
@Override
public Class<? extends MachinePackage> getPackageClass() {
return this.clss;
return clss;
}
@Override
@@ -39,19 +33,18 @@ public enum GeneticMachine implements IMachineType
return true;
}
public ItemStack get(final int i) {
return new ItemStack(Genetics.packageGenetic.getBlock(), i, this.ordinal());
public ItemStack get(int i) {
return new ItemStack(Genetics.packageGenetic.getBlock(), i, ordinal());
}
public abstract static class PackageGeneticBase extends MachinePackage
{
BinnieResource renderTexture;
int colour;
public abstract static class PackageGeneticBase extends MachinePackage {
protected BinnieResource renderTexture;
protected int colour;
protected PackageGeneticBase(final String uid, final IBinnieTexture renderTexture, final int flashColour, final boolean powered) {
protected PackageGeneticBase(String uid, IBinnieTexture renderTexture, int flashColor, boolean powered) {
super(uid, powered);
this.renderTexture = renderTexture.getTexture();
this.colour = flashColour;
colour = flashColor;
}
@Override
@@ -60,12 +53,8 @@ public enum GeneticMachine implements IMachineType
}
@Override
public void register() {
}
@Override
public void renderMachine(final Machine machine, final double x, final double y, final double z, final float partialTick, final RenderBlocks renderer) {
MachineRendererGenetics.instance.renderMachine(machine, this.colour, this.renderTexture, x, y, z, partialTick);
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
MachineRendererGenetics.instance.renderMachine(machine, colour, renderTexture, x, y, z, partialTick);
}
}
}
@@ -1,143 +1,133 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import binnie.core.machines.transfer.TransferRequest;
import binnie.core.machines.power.ErrorState;
import java.util.Random;
import binnie.core.machines.power.IProcess;
import binnie.core.machines.power.ComponentProcessIndefinate;
import binnie.core.machines.TileEntityMachine;
import net.minecraft.tileentity.TileEntity;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.ComponentTankContainer;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.genetics.core.GeneticsGUI;
import binnie.core.machines.Machine;
import binnie.genetics.core.GeneticsTexture;
import binnie.core.craftgui.minecraft.IMachineInformation;
import java.util.ArrayList;
import forestry.api.apiculture.IBee;
import binnie.core.machines.MachineUtil;
import forestry.api.apiculture.EnumBeeType;
import binnie.core.BinnieCore;
import net.minecraft.init.Items;
import binnie.genetics.item.GeneticsItems;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import binnie.genetics.item.GeneticLiquid;
import binnie.Binnie;
import binnie.core.BinnieCore;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineUtil;
import binnie.core.machines.TileEntityMachine;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.core.machines.inventory.ComponentTankContainer;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.power.ComponentProcessIndefinate;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import binnie.core.machines.transfer.TransferRequest;
import binnie.genetics.api.IIncubatorRecipe;
import java.util.List;
import binnie.genetics.core.GeneticsGUI;
import binnie.genetics.core.GeneticsTexture;
import binnie.genetics.item.GeneticLiquid;
import binnie.genetics.item.GeneticsItems;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IBee;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
public class Incubator
{
public static final int[] slotQueue;
public static final int slotIncubator = 3;
public static final int[] slotOutput;
public static final int tankInput = 0;
public static final int tankOutput = 1;
private static List<IIncubatorRecipe> RECIPES;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class Incubator {
public static int[] slotQueue = new int[]{0, 1, 2};
public static int[] slotOutput = new int[]{4, 5, 6};
public static int slotIncubator = 3;
public static int tankInput = 0;
public static int tankOutput = 1;
private static List<IIncubatorRecipe> RECIPES = new ArrayList<>();
public static void addRecipes() {
Incubator.RECIPES.add(new IncubatorRecipe(Binnie.Liquid.getLiquidStack("water", 25), GeneticLiquid.GrowthMedium.get(25), 0.2f) {
@Override
public boolean isItemStack(final ItemStack stack) {
public boolean isItemStack(ItemStack stack) {
return GeneticsItems.GrowthMedium.get(1).isItemEqual(stack);
}
});
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.GrowthMedium.get(25), GeneticLiquid.Bacteria.get(5), 0.2f) {
@Override
public boolean isItemStack(final ItemStack stack) {
public boolean isItemStack(ItemStack stack) {
return new ItemStack(Items.wheat).isItemEqual(stack);
}
});
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.Bacteria.get(0), GeneticLiquid.Bacteria.get(5), 0.05f) {
@Override
public boolean isItemStack(final ItemStack stack) {
public boolean isItemStack(ItemStack stack) {
return GeneticsItems.GrowthMedium.get(1).isItemEqual(stack);
}
});
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.Bacteria.get(2), null, 0.5f, 0.2f) {
@Override
public boolean isItemStack(final ItemStack stack) {
public boolean isItemStack(ItemStack stack) {
return stack.getItem() == Items.sugar;
}
}.setOutputStack(GeneticsItems.Enzyme.get(1)));
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.BacteriaPoly.get(0), GeneticLiquid.BacteriaPoly.get(5), 0.05f) {
@Override
public boolean isItemStack(final ItemStack stack) {
public boolean isItemStack(ItemStack stack) {
return GeneticsItems.GrowthMedium.get(1).isItemEqual(stack);
}
});
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.BacteriaVector.get(0), GeneticLiquid.BacteriaVector.get(5), 0.05f) {
@Override
public boolean isItemStack(final ItemStack stack) {
public boolean isItemStack(ItemStack stack) {
return GeneticsItems.GrowthMedium.get(1).isItemEqual(stack);
}
});
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.Bacteria.get(10), GeneticLiquid.BacteriaPoly.get(10), 0.1f) {
@Override
public boolean isItemStack(final ItemStack stack) {
public boolean isItemStack(ItemStack stack) {
return new ItemStack(Items.dye, 1, 15).isItemEqual(stack);
}
});
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.Bacteria.get(10), GeneticLiquid.BacteriaVector.get(10), 0.05f) {
@Override
public boolean isItemStack(final ItemStack stack) {
public boolean isItemStack(ItemStack stack) {
return new ItemStack(Items.blaze_powder).isItemEqual(stack);
}
});
if (BinnieCore.isApicultureActive()) {
Incubator.RECIPES.add(new IncubatorRecipe(GeneticLiquid.GrowthMedium.get(50), null, 1.0f, 0.05f) {
@Override
public boolean isItemStack(final ItemStack stack) {
public boolean isItemStack(ItemStack stack) {
return Binnie.Genetics.getBeeRoot().isMember(stack) && Binnie.Genetics.getBeeRoot().getType(stack) == EnumBeeType.LARVAE;
}
@Override
public ItemStack getOutputStack(final MachineUtil machine) {
final ItemStack larvae = machine.getStack(3);
final IBee bee = Binnie.Genetics.getBeeRoot().getMember(larvae);
public ItemStack getOutputStack(MachineUtil machine) {
ItemStack larvae = machine.getStack(3);
IBee bee = Binnie.Genetics.getBeeRoot().getMember(larvae);
return Binnie.Genetics.getBeeRoot().getMemberStack(bee, EnumBeeType.DRONE.ordinal());
}
});
}
}
static {
slotQueue = new int[] { 0, 1, 2 };
slotOutput = new int[] { 4, 5, 6 };
Incubator.RECIPES = new ArrayList<IIncubatorRecipe>();
}
public static class PackageIncubator extends GeneticMachine.PackageGeneticBase implements IMachineInformation
{
public static class PackageIncubator extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
public PackageIncubator() {
super("incubator", GeneticsTexture.Incubator, 16767313, true);
}
@Override
public void createMachine(final Machine machine) {
public void createMachine(Machine machine) {
new ComponentGeneticGUI(machine, GeneticsGUI.Incubator);
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
inventory.addSlotArray(Incubator.slotQueue, "input");
for (final InventorySlot slot : inventory.getSlots(Incubator.slotQueue)) {
for (InventorySlot slot : inventory.getSlots(Incubator.slotQueue)) {
slot.forbidExtraction();
}
inventory.addSlot(3, "incubator");
inventory.getSlot(3).forbidInteraction();
inventory.getSlot(3).setReadOnly();
inventory.addSlotArray(Incubator.slotOutput, "output");
for (final InventorySlot slot : inventory.getSlots(Incubator.slotOutput)) {
for (InventorySlot slot : inventory.getSlots(Incubator.slotOutput)) {
slot.forbidInsertion();
slot.setReadOnly();
}
new ComponentPowerReceptor(machine, 2000);
final ComponentTankContainer tanks = new ComponentTankContainer(machine);
ComponentTankContainer tanks = new ComponentTankContainer(machine);
tanks.addTank(0, "input", 2000).forbidExtraction();
tanks.addTank(1, "output", 2000).setReadOnly();
new ComponentIncubatorLogic(machine);
@@ -147,28 +137,23 @@ public class Incubator
public TileEntity createTileEntity() {
return new TileEntityMachine(this);
}
@Override
public void register() {
}
}
public static class ComponentIncubatorLogic extends ComponentProcessIndefinate implements IProcess
{
public static class ComponentIncubatorLogic extends ComponentProcessIndefinate implements IProcess {
IIncubatorRecipe recipe;
private Random rand;
private boolean roomForOutput;
public ComponentIncubatorLogic(final Machine machine) {
public ComponentIncubatorLogic(Machine machine) {
super(machine, 2.0f);
this.recipe = null;
this.rand = new Random();
this.roomForOutput = true;
recipe = null;
rand = new Random();
roomForOutput = true;
}
@Override
public ErrorState canWork() {
if (this.recipe == null) {
if (recipe == null) {
return new ErrorState("No Recipe", "There is no valid recipe");
}
return super.canWork();
@@ -176,11 +161,11 @@ public class Incubator
@Override
public ErrorState canProgress() {
if (this.recipe != null) {
if (!this.recipe.isInputLiquidSufficient(this.getUtil().getFluid(0))) {
if (recipe != null) {
if (!recipe.isInputLiquidSufficient(getUtil().getFluid(0))) {
return new ErrorState.InsufficientLiquid("Not enough incubation liquid", 0);
}
if (!this.roomForOutput) {
if (!roomForOutput) {
return new ErrorState.TankSpace("No room for output", 1);
}
}
@@ -189,20 +174,20 @@ public class Incubator
@Override
protected void onTickTask() {
if (this.rand.nextInt(20) == 0 && this.recipe != null && this.rand.nextFloat() < this.recipe.getChance()) {
this.recipe.doTask(this.getUtil());
if (rand.nextInt(20) == 0 && recipe != null && rand.nextFloat() < recipe.getChance()) {
recipe.doTask(getUtil());
}
}
@Override
public boolean inProgress() {
return this.recipe != null;
return recipe != null;
}
private IIncubatorRecipe getRecipe(final ItemStack stack, final FluidStack liquid) {
for (final IIncubatorRecipe recipe : Incubator.RECIPES) {
final boolean rightLiquid = recipe.isInputLiquid(liquid);
final boolean rightItem = recipe.isItemStack(stack);
private IIncubatorRecipe getRecipe(ItemStack stack, FluidStack liquid) {
for (IIncubatorRecipe recipe : Incubator.RECIPES) {
boolean rightLiquid = recipe.isInputLiquid(liquid);
boolean rightItem = recipe.isItemStack(stack);
if (rightLiquid && rightItem) {
return recipe;
}
@@ -213,36 +198,39 @@ public class Incubator
@Override
public void onInventoryUpdate() {
super.onInventoryUpdate();
if (!this.getUtil().isServer()) {
if (!getUtil().isServer()) {
return;
}
final FluidStack liquid = this.getUtil().getFluid(0);
final ItemStack incubator = this.getUtil().getStack(3);
if (this.recipe != null && (incubator == null || liquid == null || !this.recipe.isInputLiquid(liquid) || !this.recipe.isItemStack(incubator))) {
this.recipe = null;
final ItemStack leftover = new TransferRequest(incubator, this.getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation().transfer(true);
this.getUtil().setStack(3, leftover);
FluidStack liquid = getUtil().getFluid(0);
ItemStack incubator = getUtil().getStack(3);
if (recipe != null && (incubator == null || liquid == null || !recipe.isInputLiquid(liquid) || !recipe.isItemStack(incubator))) {
recipe = null;
ItemStack leftover = new TransferRequest(incubator, getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation().transfer(true);
getUtil().setStack(3, leftover);
}
if (this.recipe == null) {
if (recipe == null) {
if (liquid == null) {
return;
}
if (incubator != null) {
final IIncubatorRecipe recipe = this.getRecipe(incubator, liquid);
IIncubatorRecipe recipe = getRecipe(incubator, liquid);
if (recipe != null) {
this.recipe = recipe;
return;
}
}
IIncubatorRecipe potential = null;
int potentialSlot = 0;
for (final int slot : Incubator.slotQueue) {
final ItemStack stack = this.getUtil().getStack(slot);
for (int slot : Incubator.slotQueue) {
ItemStack stack = getUtil().getStack(slot);
if (stack != null) {
if (potential == null) {
for (final IIncubatorRecipe recipe2 : Incubator.RECIPES) {
final boolean rightLiquid = recipe2.isInputLiquid(liquid);
final boolean rightItem = recipe2.isItemStack(stack);
for (IIncubatorRecipe recipe2 : Incubator.RECIPES) {
boolean rightLiquid = recipe2.isInputLiquid(liquid);
boolean rightItem = recipe2.isItemStack(stack);
if (rightLiquid && rightItem) {
potential = recipe2;
potentialSlot = slot;
@@ -252,105 +240,103 @@ public class Incubator
}
}
}
if (potential != null) {
final TransferRequest removal = new TransferRequest(incubator, this.getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation();
TransferRequest removal = new TransferRequest(incubator, getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation();
if (removal.transfer(false) == null) {
this.recipe = potential;
recipe = potential;
}
removal.transfer(true);
final ItemStack stack2 = this.getUtil().getStack(potentialSlot);
this.getUtil().setStack(potentialSlot, null);
this.getUtil().setStack(3, stack2);
ItemStack stack2 = getUtil().getStack(potentialSlot);
getUtil().setStack(potentialSlot, null);
getUtil().setStack(3, stack2);
}
}
if (this.recipe != null) {
this.roomForOutput = this.recipe.roomForOutput(this.getUtil());
if (recipe != null) {
roomForOutput = recipe.roomForOutput(getUtil());
}
}
}
private class IncubatorCrafting
{
ItemStack input;
FluidStack fluid;
}
private abstract static class IncubatorRecipe implements IIncubatorRecipe {
protected FluidStack input;
protected FluidStack output;
protected float lossChance;
protected ItemStack outputStack;
protected float tickChance;
private abstract static class IncubatorRecipe implements IIncubatorRecipe
{
FluidStack input;
FluidStack output;
float lossChance;
ItemStack outputStack;
float tickChance;
@Override
public float getChance() {
return this.tickChance;
}
public IncubatorRecipe(final FluidStack input, final FluidStack output, final float lossChance) {
public IncubatorRecipe(FluidStack input, FluidStack output, float lossChance) {
this(input, output, lossChance, 1.0f);
}
public IncubatorRecipe(final FluidStack input, final FluidStack output, final float lossChance, final float chance) {
public IncubatorRecipe(FluidStack input, FluidStack output, float lossChance, float chance) {
this.input = input;
this.output = output;
this.lossChance = lossChance;
this.tickChance = chance;
tickChance = chance;
}
@Override
public boolean isInputLiquid(final FluidStack fluid) {
return fluid != null && this.input.isFluidEqual(fluid);
public float getChance() {
return tickChance;
}
@Override
public boolean isInputLiquidSufficient(final FluidStack fluid) {
return fluid != null && fluid.amount >= 500;
public boolean isInputLiquid(FluidStack liquid) {
return liquid != null && input.isFluidEqual(liquid);
}
@Override
public void doTask(final MachineUtil machine) {
machine.drainTank(0, this.input.amount);
if (this.output != null) {
machine.fillTank(1, this.output);
public boolean isInputLiquidSufficient(FluidStack liquid) {
return liquid != null && liquid.amount >= 500;
}
@Override
public void doTask(MachineUtil machine) {
machine.drainTank(0, input.amount);
if (output != null) {
machine.fillTank(1, output);
}
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.slotOutput).ignoreValidation();
outputStack = getOutputStack(machine);
if (outputStack != null) {
ItemStack output = outputStack.copy();
TransferRequest product = new TransferRequest(output, machine.getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation();
product.transfer(true);
}
final Random rand = machine.getRandom();
if (rand.nextFloat() < this.lossChance) {
Random rand = machine.getRandom();
if (rand.nextFloat() < lossChance) {
machine.decreaseStack(3, 1);
}
}
public IncubatorRecipe setOutputStack(final ItemStack stack) {
this.outputStack = stack;
public IncubatorRecipe setOutputStack(ItemStack stack) {
outputStack = stack;
return this;
}
protected ItemStack getOutputStack(final MachineUtil util) {
return this.outputStack;
protected ItemStack getOutputStack(MachineUtil util) {
return outputStack;
}
@Override
public boolean roomForOutput(final MachineUtil machine) {
if (this.output != null && !machine.isTankEmpty(1)) {
if (!machine.getFluid(1).isFluidEqual(this.output)) {
public boolean roomForOutput(MachineUtil machine) {
if (output != null && !machine.isTankEmpty(1)) {
if (!machine.getFluid(1).isFluidEqual(output)) {
return false;
}
if (!machine.spaceInTank(1, this.output.amount)) {
if (!machine.spaceInTank(1, output.amount)) {
return false;
}
}
final ItemStack outputStack = this.getOutputStack(machine);
ItemStack outputStack = getOutputStack(machine);
if (outputStack != null) {
final ItemStack output = outputStack.copy();
final TransferRequest product = new TransferRequest(output, machine.getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation();
final ItemStack leftover = product.transfer(false);
ItemStack output = outputStack.copy();
TransferRequest product = new TransferRequest(output, machine.getInventory()).setTargetSlots(Incubator.slotOutput).ignoreValidation();
ItemStack leftover = product.transfer(false);
return leftover == null;
}
return true;
@@ -1,106 +1,104 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import forestry.api.genetics.ISpeciesRoot;
import binnie.Binnie;
import net.minecraft.entity.player.EntityPlayer;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.particle.EntityFX;
import binnie.core.BinnieCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.entity.item.EntityItem;
import binnie.core.machines.network.INetwork;
import binnie.core.machines.component.IRender;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IIndividual;
import binnie.core.machines.TileEntityMachine;
import binnie.core.machines.component.IRender;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.ComponentTankContainer;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.inventory.Validator;
import binnie.core.machines.network.INetwork;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.TileEntityMachine;
import net.minecraft.tileentity.TileEntity;
import binnie.core.machines.inventory.InventorySlot;
import binnie.genetics.item.GeneticLiquid;
import net.minecraftforge.fluids.FluidStack;
import binnie.core.machines.inventory.ComponentTankContainer;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.genetics.genetics.Engineering;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.Validator;
import binnie.genetics.api.IItemSerum;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.IMachine;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.genetics.core.GeneticsGUI;
import binnie.core.machines.Machine;
import binnie.genetics.core.GeneticsTexture;
import binnie.core.craftgui.minecraft.IMachineInformation;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagCompound;
import forestry.api.genetics.IAllele;
import forestry.api.apiculture.IBeeRoot;
import forestry.api.apiculture.EnumBeeChromosome;
import net.minecraft.item.ItemStack;
import binnie.genetics.api.IGene;
import binnie.genetics.api.IItemSerum;
import binnie.genetics.core.GeneticsGUI;
import binnie.genetics.core.GeneticsTexture;
import binnie.genetics.genetics.Engineering;
import binnie.genetics.item.GeneticLiquid;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IBeeRoot;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
public class Inoculator
{
public static final int slotSerumVial = 0;
public static final int[] slotSerumReserve;
public static final int[] slotSerumExpended;
public static final int[] slotReserve;
public static final int slotTarget = 9;
public static final int[] slotFinished;
public static final int tankVector = 0;
import java.util.Random;
public static void setGene(final IGene gene, final ItemStack target, final int chromoN) {
int chromosomeID;
final int chromosome = chromosomeID = gene.getChromosome().ordinal();
public class Inoculator {
public static int slotSerumVial = 0;
public static int[] slotSerumReserve;
public static int[] slotSerumExpended;
public static int[] slotReserve;
public static int slotTarget = 9;
public static int[] slotFinished;
public static int tankVector = 0;
static {
slotSerumReserve = new int[]{1, 2};
slotSerumExpended = new int[]{3, 4};
slotReserve = new int[]{5, 6, 7, 8};
slotFinished = new int[]{10, 11, 12, 13};
}
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;
chromosomeID--;
}
final Class<? extends IAllele> cls = gene.getChromosome().getAlleleClass();
Class<? extends IAllele> cls = gene.getChromosome().getAlleleClass();
if (!cls.isInstance(gene.getAllele())) {
return;
}
final NBTTagCompound beeNBT = target.getTagCompound();
final NBTTagCompound genomeNBT = beeNBT.getCompoundTag("Genome");
final NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
final NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
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);
}
static {
slotSerumReserve = new int[] { 1, 2 };
slotSerumExpended = new int[] { 3, 4 };
slotReserve = new int[] { 5, 6, 7, 8 };
slotFinished = new int[] { 10, 11, 12, 13 };
}
public static class PackageInoculator extends GeneticMachine.PackageGeneticBase implements IMachineInformation
{
public static class PackageInoculator extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
public PackageInoculator() {
super("inoculator", GeneticsTexture.Inoculator, 14819893, true);
}
@Override
public void createMachine(final Machine machine) {
public void createMachine(Machine machine) {
new ComponentGeneticGUI(machine, GeneticsGUI.Inoculator);
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
inventory.addSlot(0, "serum.active");
inventory.getSlot(0).forbidInteraction();
inventory.getSlot(0).setReadOnly();
final SlotValidator serumValid = new SlotValidator(ModuleMachine.IconSerum) {
SlotValidator serumValid = new SlotValidator(ModuleMachine.IconSerum) {
@Override
public boolean isValid(final ItemStack itemStack) {
public boolean isValid(ItemStack itemStack) {
return itemStack.getItem() instanceof IItemSerum;
}
@@ -109,53 +107,62 @@ public class Inoculator
return "Serum Vials & Arrays";
}
};
inventory.getSlot(0).setValidator(serumValid);
inventory.addSlotArray(Inoculator.slotSerumReserve, "serum.input");
for (final InventorySlot slot : inventory.getSlots(Inoculator.slotSerumReserve)) {
for (InventorySlot slot : inventory.getSlots(Inoculator.slotSerumReserve)) {
slot.setValidator(serumValid);
slot.forbidExtraction();
}
inventory.addSlotArray(Inoculator.slotSerumExpended, "serum.output");
for (final InventorySlot slot : inventory.getSlots(Inoculator.slotSerumExpended)) {
for (InventorySlot slot : inventory.getSlots(Inoculator.slotSerumExpended)) {
slot.setValidator(serumValid);
slot.setReadOnly();
}
inventory.addSlotArray(Inoculator.slotReserve, "input");
for (final InventorySlot slot : inventory.getSlots(Inoculator.slotReserve)) {
for (InventorySlot slot : inventory.getSlots(Inoculator.slotReserve)) {
slot.forbidExtraction();
slot.setValidator(new ValidatorIndividualInoculate());
}
inventory.addSlot(9, "process");
inventory.getSlot(9).setValidator(new ValidatorIndividualInoculate());
inventory.getSlot(9).setReadOnly();
inventory.getSlot(9).forbidInteraction();
inventory.addSlotArray(Inoculator.slotFinished, "output");
for (final InventorySlot slot : inventory.getSlots(Inoculator.slotFinished)) {
for (InventorySlot slot : inventory.getSlots(Inoculator.slotFinished)) {
slot.setReadOnly();
slot.forbidInsertion();
slot.setValidator(new ValidatorIndividualInoculate());
}
final ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
transfer.addRestock(Inoculator.slotReserve, 9, 1);
transfer.addRestock(Inoculator.slotSerumReserve, 0);
transfer.addStorage(0, Inoculator.slotSerumExpended, new ComponentInventoryTransfer.Condition() {
@Override
public boolean fufilled(final ItemStack stack) {
public boolean fufilled(ItemStack stack) {
return Engineering.getCharges(stack) == 0;
}
});
transfer.addStorage(9, Inoculator.slotFinished, new ComponentInventoryTransfer.Condition() {
@Override
public boolean fufilled(final ItemStack stack) {
return stack != null && this.transfer.getMachine().getMachineUtil().getStack(0) != null && this.transfer.getMachine().getInterface(ComponentInoculatorLogic.class).isValidSerum() != null;
return stack != null
&& transfer.getMachine().getMachineUtil().getStack(0) != null
&& transfer.getMachine().getInterface(ComponentInoculatorLogic.class).isValidSerum() != null;
}
});
new ComponentPowerReceptor(machine, 15000);
new ComponentInoculatorLogic(machine);
new ComponentInoculatorFX(machine);
new ComponentTankContainer(machine).addTank(0, "input", 1000).setValidator(new Validator<FluidStack>() {
@Override
public boolean isValid(final FluidStack object) {
public boolean isValid(FluidStack object) {
return GeneticLiquid.BacteriaVector.get(1).isFluidEqual(object);
}
@@ -170,28 +177,28 @@ public class Inoculator
public TileEntity createTileEntity() {
return new TileEntityMachine(this);
}
@Override
public void register() {
}
}
public static class ComponentInoculatorLogic extends ComponentProcessSetCost implements IProcess
{
public static class ComponentInoculatorLogic extends ComponentProcessSetCost implements IProcess {
private float bacteriaDrain;
public ComponentInoculatorLogic(Machine machine) {
super(machine, 600000, 12000);
bacteriaDrain = 0.0f;
}
@Override
public int getProcessLength() {
return super.getProcessLength() * this.getNumberOfGenes();
return super.getProcessLength() * getNumberOfGenes();
}
@Override
public int getProcessEnergy() {
return super.getProcessEnergy() * this.getNumberOfGenes();
return super.getProcessEnergy() * getNumberOfGenes();
}
private int getNumberOfGenes() {
final ItemStack serum = this.getUtil().getStack(0);
ItemStack serum = getUtil().getStack(0);
if (serum == null) {
return 1;
}
@@ -200,52 +207,53 @@ public class Inoculator
@Override
public String getTooltip() {
final int n = this.getNumberOfGenes();
int n = getNumberOfGenes();
return "Inoculating with " + n + " gene" + ((n > 1) ? "s" : "");
}
public ComponentInoculatorLogic(final Machine machine) {
super(machine, 600000, 12000);
this.bacteriaDrain = 0.0f;
}
@Override
public ErrorState canWork() {
if (this.getUtil().isSlotEmpty(9)) {
if (getUtil().isSlotEmpty(9)) {
return new ErrorState.NoItem("No Individual to Inoculate", 9);
}
if (this.getUtil().isSlotEmpty(0)) {
if (getUtil().isSlotEmpty(0)) {
return new ErrorState.NoItem("No Serum", 0);
}
final ErrorState state = this.isValidSerum();
ErrorState state = isValidSerum();
if (state != null) {
return state;
}
if (this.getUtil().getStack(0) != null && Engineering.getCharges(this.getUtil().getStack(0)) == 0) {
if (getUtil().getStack(0) != null && Engineering.getCharges(getUtil().getStack(0)) == 0) {
return new ErrorState("Empty Serum", "Serum is empty");
}
return super.canWork();
}
public ErrorState isValidSerum() {
final ItemStack serum = this.getUtil().getStack(0);
final ItemStack target = this.getUtil().getStack(9);
final IGene[] genes = Engineering.getGenes(serum);
ItemStack serum = getUtil().getStack(0);
ItemStack target = getUtil().getStack(9);
IGene[] genes = Engineering.getGenes(serum);
if (genes.length == 0) {
return new ErrorState("Invalid Serum", "Serum does not hold any genes");
}
if (!genes[0].getSpeciesRoot().isMember(target)) {
return new ErrorState("Invalid Serum", "Mismatch of Serum Type and Target");
}
final IIndividual individual = genes[0].getSpeciesRoot().getMember(target);
IIndividual individual = genes[0].getSpeciesRoot().getMember(target);
boolean hasAll = true;
for (final IGene gene : genes) {
for (IGene gene : genes) {
if (hasAll) {
final IAllele a = individual.getGenome().getActiveAllele(gene.getChromosome());
final IAllele b = individual.getGenome().getInactiveAllele(gene.getChromosome());
hasAll = (hasAll && a.getUID().equals(gene.getAllele().getUID()) && b.getUID().equals(gene.getAllele().getUID()));
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("Defunct Serum", "Individual already possesses this allele");
}
@@ -260,84 +268,84 @@ public class Inoculator
@Override
protected void onFinishTask() {
super.onFinishTask();
final ItemStack serum = this.getUtil().getStack(0);
final ItemStack target = this.getUtil().getStack(9);
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
ItemStack serum = getUtil().getStack(0);
ItemStack target = getUtil().getStack(9);
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
if (!ind.isAnalyzed()) {
ind.analyze();
final NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTTagCompound nbttagcompound = new NBTTagCompound();
ind.writeToNBT(nbttagcompound);
target.setTagCompound(nbttagcompound);
}
final IGene[] arr$;
final IGene[] genes = arr$ = ((IItemSerum) serum.getItem()).getGenes(serum);
for (final IGene gene : arr$) {
IGene[] genes = ((IItemSerum) serum.getItem()).getGenes(serum);
for (IGene gene : genes) {
Inoculator.setGene(gene, target, 0);
Inoculator.setGene(gene, target, 1);
}
this.getUtil().damageItem(0, 1);
getUtil().damageItem(0, 1);
}
@Override
protected void onTickTask() {
this.bacteriaDrain += 15.0f * this.getProgressPerTick() / 100.0f;
if (this.bacteriaDrain >= 1.0f) {
this.getUtil().drainTank(0, 1);
--this.bacteriaDrain;
bacteriaDrain += 15.0f * getProgressPerTick() / 100.0f;
if (bacteriaDrain >= 1.0f) {
getUtil().drainTank(0, 1);
bacteriaDrain--;
}
}
}
public static class ComponentInoculatorFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync
{
private final EntityItem dummyEntityItem;
public static class ComponentInoculatorFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync {
private EntityItem dummyEntityItem;
public ComponentInoculatorFX(final IMachine machine) {
public ComponentInoculatorFX(IMachine machine) {
super(machine);
this.dummyEntityItem = new EntityItem((World) null);
dummyEntityItem = new EntityItem(null);
}
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
// ignored
}
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 3L);
if (tick == 0 && this.getUtil().getProcess().isInProgress()) {
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 = this.posX;
double axisZ = this.posZ;
double angle = (int) (this.worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
double axisX = posX;
double axisZ = posZ;
double angle = (int) (worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.007 + this.rand.nextDouble() * 0.002;
this.particleMaxAge = 240;
this.particleGravity = 0.0f;
this.noClip = true;
this.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 (this.particleAge > 60) {
speed += (this.particleAge - 60) / 4000.0f;
if (particleAge > 60) {
speed += (particleAge - 60) / 4000.0f;
}
this.angle += speed;
final double dist = 0.27;
this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
if (this.particleAge > 40) {
this.setRBGColorF(this.particleRed + (1.0f - this.particleRed) / 10.0f, this.particleGreen + (0.0f - this.particleGreen) / 10.0f, this.particleBlue + (0.0f - this.particleBlue) / 10.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);
}
}
@@ -351,23 +359,26 @@ public class Inoculator
@SideOnly(Side.CLIENT)
@Override
public void renderInWorld(final RenderItem renderItem, final double x, final double y, final double z) {
if (!this.getUtil().getProcess().isInProgress()) {
public void renderInWorld(RenderItem renderItem, double x, double y, double z) {
// TODO fix duplicate code
if (!getUtil().getProcess().isInProgress()) {
return;
}
final ItemStack stack = this.getUtil().getStack(9);
this.dummyEntityItem.worldObj = this.getMachine().getWorld();
this.dummyEntityItem.setEntityItemStack(stack);
final EntityItem dummyEntityItem = this.dummyEntityItem;
++dummyEntityItem.age;
ItemStack stack = getUtil().getStack(9);
dummyEntityItem.worldObj = getMachine().getWorld();
dummyEntityItem.setEntityItemStack(stack);
EntityItem dummyEntityItem = this.dummyEntityItem;
dummyEntityItem.age++;
this.dummyEntityItem.hoverStart = 0.0f;
if (stack == null) {
return;
}
final EntityPlayer player = BinnieCore.proxy.getPlayer();
final double dx = x + 0.5 - player.lastTickPosX;
final double dz = z + 0.5 - player.lastTickPosZ;
final double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
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.25f, 0.0f);
@@ -376,9 +387,9 @@ public class Inoculator
}
@Override
public void syncToNBT(final NBTTagCompound nbt) {
final NBTTagCompound item = new NBTTagCompound();
final ItemStack stack = this.getUtil().getStack(9);
public void syncToNBT(NBTTagCompound nbt) {
NBTTagCompound item = new NBTTagCompound();
ItemStack stack = getUtil().getStack(9);
if (stack != null) {
stack.writeToNBT(item);
nbt.setTag("item", item);
@@ -386,33 +397,31 @@ public class Inoculator
}
@Override
public void syncFromNBT(final NBTTagCompound nbt) {
public void syncFromNBT(NBTTagCompound nbt) {
if (nbt.hasKey("item")) {
this.getUtil().setStack(9, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
}
else {
this.getUtil().setStack(9, null);
getUtil().setStack(9, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
} else {
getUtil().setStack(9, null);
}
}
@Override
public void onInventoryUpdate() {
if (!this.getUtil().isServer()) {
if (!getUtil().isServer()) {
return;
}
this.getUtil().refreshBlock();
getUtil().refreshBlock();
}
}
public static class ValidatorIndividualInoculate extends SlotValidator
{
public static class ValidatorIndividualInoculate extends SlotValidator {
public ValidatorIndividualInoculate() {
super(null);
}
@Override
public boolean isValid(final ItemStack object) {
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(object);
public boolean isValid(ItemStack object) {
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(object);
return root != null && Binnie.Genetics.getSystem(root).isDNAManipulable(object);
}
@@ -1,72 +1,62 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.particle.EntityFX;
import binnie.core.BinnieCore;
import net.minecraft.world.World;
import binnie.core.machines.component.IRender;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.inventory.IChargedSlots;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import java.util.Random;
import binnie.genetics.item.ItemSequence;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.genetics.Gene;
import forestry.api.genetics.AlleleManager;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.TileEntityMachine;
import binnie.core.machines.component.IRender;
import binnie.core.machines.inventory.ComponentChargedSlots;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.ComponentTankContainer;
import binnie.core.machines.inventory.IChargedSlots;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.inventory.TankValidator;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.TileEntityMachine;
import net.minecraft.tileentity.TileEntity;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.ComponentChargedSlots;
import net.minecraftforge.fluids.FluidStack;
import binnie.core.machines.inventory.TankValidator;
import binnie.core.machines.inventory.ComponentTankContainer;
import binnie.core.machines.inventory.SlotValidator;
import binnie.genetics.item.GeneticsItems;
import binnie.core.machines.IMachine;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.genetics.core.GeneticsGUI;
import binnie.core.machines.Machine;
import binnie.genetics.core.GeneticsTexture;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.genetics.item.GeneticsItems;
import binnie.genetics.item.ItemSequence;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
public class Isolator
{
public static final int slotEnzyme = 0;
public static final int slotSequencerVial = 1;
public static final int[] slotReserve;
public static final int slotTarget = 5;
public static final int slotResult = 6;
public static final int[] slotFinished;
public static final int tankEthanol = 0;
import java.util.Random;
static {
slotReserve = new int[] { 2, 3, 4 };
slotFinished = new int[] { 7, 8, 9, 10, 11, 12 };
}
public class Isolator {
public static int slotEnzyme = 0;
public static int slotSequencerVial = 1;
public static int[] slotReserve = new int[]{2, 3, 4};
public static int[] slotFinished = new int[]{7, 8, 9, 10, 11, 12};
public static int slotTarget = 5;
public static int slotResult = 6;
public static int tankEthanol = 0;
public static class PackageIsolator extends GeneticMachine.PackageGeneticBase implements IMachineInformation
{
public static class PackageIsolator extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
public PackageIsolator() {
super("isolator", GeneticsTexture.Isolator, 16740111, true);
}
@Override
public void createMachine(final Machine machine) {
public void createMachine(Machine machine) {
new ComponentGeneticGUI(machine, GeneticsGUI.Isolator);
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
inventory.addSlot(0, "enzyme");
inventory.getSlot(0).setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.IconEnzyme));
inventory.getSlot(0).forbidExtraction();
@@ -74,23 +64,26 @@ public class Isolator
inventory.getSlot(1).setValidator(new SlotValidator.Item(GeneticsItems.EmptySequencer.get(1), ModuleMachine.IconSequencer));
inventory.getSlot(1).forbidExtraction();
inventory.addSlotArray(Isolator.slotReserve, "input");
for (final InventorySlot slot : inventory.getSlots(Isolator.slotReserve)) {
for (InventorySlot slot : inventory.getSlots(Isolator.slotReserve)) {
slot.setValidator(new SlotValidator.Individual());
slot.forbidExtraction();
}
inventory.addSlot(5, "process");
inventory.getSlot(5).setValidator(new SlotValidator.Individual());
inventory.getSlot(5).setReadOnly();
inventory.getSlot(5).forbidInteraction();
inventory.addSlot(6, "output");
inventory.getSlot(6).setReadOnly();
inventory.getSlot(6).forbidInteraction();
inventory.addSlotArray(Isolator.slotFinished, "output");
for (final InventorySlot slot : inventory.getSlots(Isolator.slotFinished)) {
for (InventorySlot slot : inventory.getSlots(Isolator.slotFinished)) {
slot.setReadOnly();
slot.forbidInsertion();
}
final ComponentTankContainer tanks = new ComponentTankContainer(machine);
ComponentTankContainer tanks = new ComponentTankContainer(machine);
tanks.addTank(0, "input", 1000);
tanks.getTankSlot(0).setValidator(new TankValidator() {
@Override
@@ -99,13 +92,14 @@ public class Isolator
}
@Override
public boolean isValid(final FluidStack liquid) {
public boolean isValid(FluidStack liquid) {
return liquid.getFluid().getName() == "bioethanol";
}
});
final ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine);
ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine);
chargedSlots.addCharge(0);
final ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
transfer.addRestock(Isolator.slotReserve, 5, 1);
transfer.addStorage(6, Isolator.slotFinished);
new ComponentPowerReceptor(machine, 20000);
@@ -117,32 +111,27 @@ public class Isolator
public TileEntity createTileEntity() {
return new TileEntityMachine(this);
}
@Override
public void register() {
}
}
public static class ComponentIsolatorLogic extends ComponentProcessSetCost implements IProcess
{
float enzymePerProcess;
float ethanolPerProcess;
public static class ComponentIsolatorLogic extends ComponentProcessSetCost implements IProcess {
protected float enzymePerProcess;
protected float ethanolPerProcess;
public ComponentIsolatorLogic(final Machine machine) {
public ComponentIsolatorLogic(Machine machine) {
super(machine, 192000, 4800);
this.enzymePerProcess = 0.5f;
this.ethanolPerProcess = 10.0f;
enzymePerProcess = 0.5f;
ethanolPerProcess = 10.0f;
}
@Override
public ErrorState canWork() {
if (this.getUtil().isSlotEmpty(5)) {
if (getUtil().isSlotEmpty(5)) {
return new ErrorState.NoItem("No individual to isolate", 5);
}
if (!this.getUtil().isSlotEmpty(6)) {
if (!getUtil().isSlotEmpty(6)) {
return new ErrorState.NoSpace("No room for DNA sequences", Isolator.slotFinished);
}
if (this.getUtil().isSlotEmpty(1)) {
if (getUtil().isSlotEmpty(1)) {
return new ErrorState.NoItem("No empty sequencer vials", 1);
}
return super.canWork();
@@ -150,10 +139,10 @@ public class Isolator
@Override
public ErrorState canProgress() {
if (!this.getUtil().liquidInTank(0, (int) this.ethanolPerProcess)) {
if (!getUtil().liquidInTank(0, (int) ethanolPerProcess)) {
return new ErrorState.InsufficientLiquid("Insufficient ethanol", 0);
}
if (this.getUtil().getSlotCharge(0) == 0.0f) {
if (getUtil().getSlotCharge(0) == 0.0f) {
return new ErrorState.NoItem("No enzyme", 0);
}
return super.canProgress();
@@ -162,53 +151,58 @@ public class Isolator
@Override
protected void onFinishTask() {
super.onFinishTask();
final Random rand = this.getMachine().getWorld().rand;
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(this.getUtil().getStack(5));
Random rand = getMachine().getWorld().rand;
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(getUtil().getStack(5));
if (root == null) {
return;
}
final IIndividual individual = root.getMember(this.getUtil().getStack(5));
IIndividual individual = root.getMember(getUtil().getStack(5));
if (individual == null) {
return;
}
IAllele allele = null;
IChromosomeType chromosome = null;
IAllele allele;
IChromosomeType chromosome;
Gene gene = null;
if (this.getMachine().getWorld().rand.nextFloat() < 2.0f) {
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));
allele = rand.nextBoolean() ?
individual.getGenome().getActiveAllele(chromosome) :
individual.getGenome().getInactiveAllele(chromosome);
gene = Gene.create(allele, chromosome, root);
} catch (Exception e) {
// ignored
}
}
}
final ItemStack serum = ItemSequence.create(gene);
this.getUtil().setStack(6, serum);
this.getUtil().decreaseStack(1, 1);
ItemStack serum = ItemSequence.create(gene);
getUtil().setStack(6, serum);
getUtil().decreaseStack(1, 1);
if (rand.nextFloat() < 0.05f) {
this.getUtil().decreaseStack(5, 1);
getUtil().decreaseStack(5, 1);
}
this.getUtil().drainTank(0, (int) this.ethanolPerProcess);
getUtil().drainTank(0, (int) ethanolPerProcess);
}
@Override
protected void onTickTask() {
this.getMachine().getInterface(IChargedSlots.class).alterCharge(0, -this.enzymePerProcess * this.getProgressPerTick() / 100.0f);
getMachine().getInterface(IChargedSlots.class).alterCharge(0, -enzymePerProcess * getProgressPerTick() / 100.0f);
}
}
public static class ComponentIsolaterFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick
{
public ComponentIsolaterFX(final IMachine machine) {
public static class ComponentIsolaterFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
public ComponentIsolaterFX(IMachine machine) {
super(machine);
}
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
if (!this.getUtil().getProcess().isInProgress()) {
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) {
@@ -217,20 +211,20 @@ public class Isolator
double angle = 0.0;
{
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = -0.012;
this.particleMaxAge = 100;
this.particleGravity = 0.0f;
this.noClip = true;
this.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();
this.angle += 0.06;
this.setAlphaF((float) Math.sin(3.14 * this.particleAge / this.particleMaxAge));
angle += 0.06;
setAlphaF((float) Math.sin(3.14 * particleAge / particleMaxAge));
}
@Override
@@ -242,33 +236,33 @@ public class Isolator
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 6L);
if ((tick == 0 || tick == 5) && this.getUtil().getProcess().isInProgress()) {
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()) {
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = 0.7 + (int) (this.worldObj.getTotalWorldTime() % 2L) * 3.1415;
double axisX = posX;
double axisZ = posZ;
double angle = 0.7 + (int) (worldObj.getTotalWorldTime() % 2L) * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.012;
this.particleMaxAge = 100;
this.particleGravity = 0.0f;
this.noClip = true;
this.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();
this.angle += 0.06;
this.setPosition(this.axisX + 0.26 * Math.sin(this.angle), this.posY, this.axisZ + 0.26 * Math.cos(this.angle));
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
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
@@ -1,38 +1,33 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import java.util.List;
import binnie.extratrees.ExtraTrees;
import binnie.extrabees.ExtraBees;
import binnie.botany.Botany;
import net.minecraft.item.Item;
import java.util.ArrayList;
import buildcraft.api.tools.IToolWrench;
import binnie.core.BinnieCore;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import binnie.core.machines.IMachine;
import binnie.core.machines.IMachineType;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.MachinePackage;
import binnie.core.machines.component.IInteraction;
import binnie.core.machines.network.INetwork;
import binnie.core.machines.MachineComponent;
import net.minecraft.client.renderer.RenderBlocks;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.genetics.core.GeneticsTexture;
import net.minecraft.block.Block;
import binnie.extrabees.ExtraBees;
import binnie.extratrees.ExtraTrees;
import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsTexture;
import buildcraft.api.tools.IToolWrench;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import binnie.core.machines.MachinePackage;
import binnie.core.machines.IMachineType;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public enum LaboratoryMachine implements IMachineType
{
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public enum LaboratoryMachine implements IMachineType {
LabMachine(PackageLabMachine.class),
Analyser(Analyser.PackageAnalyser.class),
Incubator(Incubator.PackageIncubator.class),
@@ -41,13 +36,13 @@ public enum LaboratoryMachine implements IMachineType
Class<? extends MachinePackage> clss;
private LaboratoryMachine(final Class<? extends MachinePackage> clss) {
LaboratoryMachine(Class<? extends MachinePackage> clss) {
this.clss = clss;
}
@Override
public Class<? extends MachinePackage> getPackageClass() {
return this.clss;
return clss;
}
@Override
@@ -55,104 +50,113 @@ public enum LaboratoryMachine implements IMachineType
return true;
}
public ItemStack get(final int i) {
return new ItemStack(Genetics.packageLabMachine.getBlock(), i, this.ordinal());
public ItemStack get(int i) {
return new ItemStack(Genetics.packageLabMachine.getBlock(), i, ordinal());
}
public static class PackageLabMachine extends GeneticMachine.PackageGeneticBase
{
public static class PackageLabMachine extends GeneticMachine.PackageGeneticBase {
public PackageLabMachine() {
super("labMachine", GeneticsTexture.LabMachine, 16777215, false);
}
@Override
public void createMachine(final Machine machine) {
public void createMachine(Machine machine) {
new ComponentGUIHolder(machine);
}
@Override
public void renderMachine(final Machine machine, final double x, final double y, final double z, final float partialTick, final RenderBlocks renderer) {
MachineRendererLab.instance.renderMachine(machine, this.colour, this.renderTexture, x, y, z, partialTick);
public void renderMachine(Machine machine, double x, double y, double z, float partialTick, RenderBlocks renderer) {
MachineRendererLab.instance.renderMachine(machine, colour, renderTexture, x, y, z, partialTick);
}
}
public static class ComponentGUIHolder extends MachineComponent implements INetwork.TilePacketSync, IInteraction.RightClick
{
public static class ComponentGUIHolder extends MachineComponent implements INetwork.TilePacketSync, IInteraction.RightClick {
private ItemStack stack;
public ComponentGUIHolder(final IMachine machine) {
public ComponentGUIHolder(IMachine machine) {
super(machine);
}
public ItemStack getStack() {
return this.stack;
return stack;
}
@Override
public void readFromNBT(final NBTTagCompound nbttagcompound) {
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
if (nbttagcompound == null) {
return;
}
this.stack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Item"));
stack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Item"));
}
@Override
public void writeToNBT(final NBTTagCompound nbttagcompound) {
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
final NBTTagCompound nbt = new NBTTagCompound();
if (this.stack != null) {
this.stack.writeToNBT(nbt);
NBTTagCompound nbt = new NBTTagCompound();
if (stack != null) {
stack.writeToNBT(nbt);
}
nbttagcompound.setTag("Item", nbt);
}
@Override
public void syncToNBT(final NBTTagCompound nbt) {
this.writeToNBT(nbt);
public void syncToNBT(NBTTagCompound nbt) {
writeToNBT(nbt);
}
@Override
public void syncFromNBT(final NBTTagCompound nbt) {
this.readFromNBT(nbt);
public void syncFromNBT(NBTTagCompound nbt) {
readFromNBT(nbt);
}
@Override
public void onDestruction() {
super.onDestruction();
if (this.stack != null) {
final float f = this.getMachine().getWorld().rand.nextFloat() * 0.8f + 0.1f;
final float f2 = this.getMachine().getWorld().rand.nextFloat() * 0.8f + 0.1f;
final float f3 = this.getMachine().getWorld().rand.nextFloat() * 0.8f + 0.1f;
if (this.stack.stackSize == 0) {
this.stack.stackSize = 1;
}
final EntityItem entityitem = new EntityItem(this.getMachine().getWorld(), this.getMachine().getTileEntity().xCoord + f, this.getMachine().getTileEntity().yCoord + f2, this.getMachine().getTileEntity().zCoord + f3, this.stack.copy());
final float accel = 0.05f;
entityitem.motionX = (float) this.getMachine().getWorld().rand.nextGaussian() * accel;
entityitem.motionY = (float) this.getMachine().getWorld().rand.nextGaussian() * accel + 0.2f;
entityitem.motionZ = (float) this.getMachine().getWorld().rand.nextGaussian() * accel;
this.getMachine().getWorld().spawnEntityInWorld(entityitem);
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;
}
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);
}
@Override
public void onRightClick(final World world, final EntityPlayer player, final int x, final int y, final int z) {
public void onRightClick(World world, EntityPlayer player, int x, int y, int z) {
if (BinnieCore.proxy.isSimulating(world) && player.getHeldItem() != null) {
if (this.stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
final float f = 0.7f;
final double d0 = world.rand.nextFloat() * f + (1.0f - f) * 0.5;
final double d2 = world.rand.nextFloat() * f + (1.0f - f) * 0.5;
final double d3 = world.rand.nextFloat() * f + (1.0f - f) * 0.5;
final EntityItem entityitem = new EntityItem(world, x + d0, y + d2, z + d3, this.stack);
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, x + xOffset, y + yOffset, z + zOffset, stack);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
this.stack = null;
stack = null;
((IToolWrench) player.getHeldItem().getItem()).wrenchUsed(player, x, y, z);
this.getUtil().refreshBlock();
getUtil().refreshBlock();
return;
}
final List<Item> validSelections = new ArrayList<Item>();
List<Item> validSelections = new ArrayList<>();
if (BinnieCore.isBotanyActive()) {
validSelections.add(Botany.database);
}
@@ -165,24 +169,28 @@ public enum LaboratoryMachine implements IMachineType
if (BinnieCore.isLepidopteryActive()) {
validSelections.add(ExtraTrees.itemDictionaryLepi);
}
validSelections.add(Genetics.database);
validSelections.add(Genetics.analyst);
validSelections.add(Genetics.registry);
validSelections.add(Genetics.masterRegistry);
validSelections.add(BinnieCore.genesis);
if (this.stack == null && validSelections.contains(player.getHeldItem().getItem())) {
this.stack = player.getHeldItem().copy();
final ItemStack heldItem = player.getHeldItem();
--heldItem.stackSize;
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 (this.stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
this.stack.getItem().onItemRightClick(this.stack, world, player);
if (stack != null && player.getHeldItem().getItem() instanceof IToolWrench) {
stack.getItem().onItemRightClick(stack, world, player);
}
}
if (this.stack != null) {
this.stack.getItem().onItemRightClick(this.stack, world, player);
if (stack != null) {
stack.getItem().onItemRightClick(stack, world, player);
}
}
}
@@ -1,30 +1,30 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import binnie.core.machines.component.IRender;
import net.minecraft.client.Minecraft;
import binnie.core.BinnieCore;
import org.lwjgl.opengl.GL11;
import binnie.core.resource.BinnieResource;
import binnie.core.machines.Machine;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderItem;
import binnie.core.machines.component.IRender;
import binnie.core.resource.BinnieResource;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class MachineRendererGenetics
{
public class MachineRendererGenetics {
public static MachineRendererGenetics instance;
public final RenderItem customRenderItem;
static {
MachineRendererGenetics.instance = new MachineRendererGenetics();
}
public RenderItem customRenderItem;
private ModelMachine model;
public MachineRendererGenetics() {
this.model = new ModelMachine();
(this.customRenderItem = new RenderItem() {
model = new ModelMachine();
customRenderItem = new RenderItem() {
@Override
public boolean shouldBob() {
return false;
@@ -34,37 +34,36 @@ public class MachineRendererGenetics
public boolean shouldSpreadItems() {
return false;
}
}).setRenderManager(RenderManager.instance);
};
customRenderItem.setRenderManager(RenderManager.instance);
}
public void renderMachine(final Machine machine, final int colour, final BinnieResource texture, final double x, final double y, final double z, final float var8) {
public void renderMachine(Machine machine, int colour, BinnieResource texture, double x, double y, double z, float var8) {
GL11.glPushMatrix();
int i1 = 0;
final int ix = machine.getTileEntity().xCoord;
final int iy = machine.getTileEntity().yCoord;
final int iz = machine.getTileEntity().zCoord;
int ix = machine.getTileEntity().xCoord;
int iy = machine.getTileEntity().yCoord;
int iz = machine.getTileEntity().zCoord;
if (machine.getTileEntity() != null) {
i1 = ix * iy * iz + ix * iy - ix * iz + iy * iz - ix + iy - iz;
}
final float phase = (float) Math.max(0.0, Math.sin((System.currentTimeMillis() + i1) * 0.003));
float phase = (float) Math.max(0.0, Math.sin((System.currentTimeMillis() + i1) * 0.003));
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();
this.model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
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 (final IRender.Render render : machine.getInterfaces(IRender.Render.class)) {
render.renderInWorld(this.customRenderItem, x, y, z);
for (IRender.Render render : machine.getInterfaces(IRender.Render.class)) {
render.renderInWorld(customRenderItem, x, y, z);
}
}
GL11.glPopMatrix();
GL11.glPopMatrix();
}
static {
MachineRendererGenetics.instance = new MachineRendererGenetics();
}
}
@@ -1,38 +1,34 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.client.Minecraft;
import binnie.core.BinnieCore;
import org.lwjgl.opengl.GL11;
import binnie.core.resource.BinnieResource;
import binnie.core.machines.Machine;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.world.World;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.item.EntityItem;
import binnie.core.resource.BinnieResource;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class MachineRendererLab
{
public static MachineRendererLab instance;
private final EntityItem dummyEntityItem;
private final EntityItem[] itemSides;
private final RenderItem customRenderItem;
public class MachineRendererLab {
public static MachineRendererLab instance = new MachineRendererLab();
private EntityItem dummyEntityItem;
private EntityItem[] itemSides;
private RenderItem customRenderItem;
private long lastTick;
private ModelMachine model;
public MachineRendererLab() {
this.dummyEntityItem = new EntityItem((World) null);
this.itemSides = new EntityItem[] { new EntityItem((World) null), new EntityItem((World) null), new EntityItem((World) null), new EntityItem((World) null) };
this.model = new ModelMachine();
(this.customRenderItem = new RenderItem() {
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;
@@ -45,42 +41,46 @@ public class MachineRendererLab
}).setRenderManager(RenderManager.instance);
}
public void renderMachine(final Machine machine, final int colour, final BinnieResource texture, final double x, final double y, final double z, final float var8) {
public void renderMachine(Machine machine, int colour, BinnieResource texture, double x, double y, double z, float var8) {
GL11.glPushMatrix();
int i1 = 0;
final int ix = machine.getTileEntity().xCoord;
final int iy = machine.getTileEntity().yCoord;
final int iz = machine.getTileEntity().zCoord;
int ix = machine.getTileEntity().xCoord;
int iy = machine.getTileEntity().yCoord;
int iz = machine.getTileEntity().zCoord;
if (machine.getTileEntity() != null) {
i1 = ix * iy * iz + ix * iy - ix * iz + iy * iz - ix + iy - iz;
}
final float phase = (float) Math.max(0.0, Math.sin((System.currentTimeMillis() + i1) * 0.003));
float phase = (float) Math.max(0.0, Math.sin((System.currentTimeMillis() + i1) * 0.003));
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();
this.model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
GL11.glPopMatrix();
final World world = machine.getWorld();
final LaboratoryMachine.ComponentGUIHolder holder = Machine.getInterface(LaboratoryMachine.ComponentGUIHolder.class, machine);
Label_0591: {
World world = machine.getWorld();
LaboratoryMachine.ComponentGUIHolder holder = Machine.getInterface(LaboratoryMachine.ComponentGUIHolder.class, machine);
// TODO remove label
Label_0591:
{
if (world != null && holder != null && holder.getStack() != null) {
BinnieCore.proxy.getMinecraftInstance();
if (Minecraft.isFancyGraphicsEnabled()) {
final ItemStack stack = holder.getStack();
this.dummyEntityItem.worldObj = world;
this.dummyEntityItem.setEntityItemStack(stack);
if (world.getTotalWorldTime() != this.lastTick) {
this.lastTick = world.getTotalWorldTime();
this.dummyEntityItem.onUpdate();
ItemStack stack = holder.getStack();
dummyEntityItem.worldObj = world;
dummyEntityItem.setEntityItemStack(stack);
if (world.getTotalWorldTime() != lastTick) {
lastTick = world.getTotalWorldTime();
dummyEntityItem.onUpdate();
}
this.dummyEntityItem.age = 0;
this.dummyEntityItem.hoverStart = 0.0f;
dummyEntityItem.age = 0;
dummyEntityItem.hoverStart = 0.0f;
GL11.glPushMatrix();
final EntityPlayer player = BinnieCore.proxy.getPlayer();
final double dx = ix + 0.5 - player.lastTickPosX;
final double dz = iz + 0.5 - player.lastTickPosZ;
final double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
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);
@@ -88,10 +88,10 @@ public class MachineRendererLab
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);
this.customRenderItem.doRender(this.dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
customRenderItem.doRender(dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
GL11.glPopMatrix();
int rot = 0;
for (final EntityItem item : this.itemSides) {
for (EntityItem item : itemSides) {
GL11.glPushMatrix();
item.worldObj = world;
item.setEntityItemStack(stack);
@@ -101,22 +101,19 @@ public class MachineRendererLab
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);
this.customRenderItem.doRender(item, 0.0, 0.0, 0.0, 0.0f, 0.0f);
customRenderItem.doRender(item, 0.0, 0.0, 0.0, 0.0f, 0.0f);
rot += 90;
GL11.glPopMatrix();
}
break Label_0591;
}
}
this.dummyEntityItem.setEntityItemStack((ItemStack) null);
for (final EntityItem item2 : this.itemSides) {
item2.setEntityItemStack((ItemStack) null);
dummyEntityItem.setEntityItemStack(null);
for (EntityItem item2 : itemSides) {
item2.setEntityItemStack(null);
}
}
GL11.glPopMatrix();
}
static {
MachineRendererLab.instance = new MachineRendererLab();
}
}
@@ -1,82 +1,90 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import net.minecraft.entity.Entity;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelMachine extends ModelBase
{
ModelRenderer Base;
ModelRenderer Body;
ModelRenderer Arm1;
ModelRenderer Arm2;
ModelRenderer Arm3;
ModelRenderer Arm4;
ModelRenderer Top;
public class ModelMachine extends ModelBase {
ModelRenderer base;
ModelRenderer body;
ModelRenderer arm1;
ModelRenderer arm2;
ModelRenderer arm3;
ModelRenderer arm4;
ModelRenderer top;
public ModelMachine() {
this.textureWidth = 64;
this.textureHeight = 64;
(this.Base = new ModelRenderer(this, 0, 18)).addBox(0.0f, 0.0f, 0.0f, 16, 4, 16);
this.Base.setRotationPoint(-8.0f, 20.0f, -8.0f);
this.Base.setTextureSize(64, 64);
this.Base.mirror = true;
this.setRotation(this.Base, 0.0f, 0.0f, 0.0f);
(this.Body = new ModelRenderer(this, 0, 26)).addBox(0.0f, 0.0f, 0.0f, 12, 7, 12);
this.Body.setRotationPoint(-6.0f, 13.0f, -6.0f);
this.Body.setTextureSize(64, 64);
this.Body.mirror = true;
this.setRotation(this.Body, 0.0f, 0.0f, 0.0f);
(this.Arm1 = new ModelRenderer(this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
this.Arm1.setRotationPoint(5.0f, 8.0f, 5.0f);
this.Arm1.setTextureSize(64, 64);
this.Arm1.mirror = true;
this.setRotation(this.Arm1, 0.0f, 0.0f, 0.0f);
(this.Arm2 = new ModelRenderer(this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
this.Arm2.setRotationPoint(-5.0f, 8.0f, 5.0f);
this.Arm2.setTextureSize(64, 64);
this.Arm2.mirror = true;
this.setRotation(this.Arm2, 0.0f, -1.57075f, 0.0f);
(this.Arm3 = new ModelRenderer(this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
this.Arm3.setRotationPoint(-5.0f, 8.0f, -5.0f);
this.Arm3.setTextureSize(64, 64);
this.Arm3.mirror = true;
this.setRotation(this.Arm3, 0.0f, -3.1415f, 0.0f);
(this.Arm4 = new ModelRenderer(this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
this.Arm4.setRotationPoint(5.0f, 8.0f, -5.0f);
this.Arm4.setTextureSize(64, 64);
this.Arm4.mirror = true;
this.setRotation(this.Arm4, 0.0f, -4.7122498f, 0.0f);
(this.Top = new ModelRenderer(this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 14, 4, 14);
this.Top.setRotationPoint(-7.0f, 9.0f, -7.0f);
this.Top.setTextureSize(64, 64);
this.Top.mirror = true;
this.setRotation(this.Top, 0.0f, 0.0f, 0.0f);
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);
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);
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);
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);
}
public void render(final float f, final float f1, final float f2, final float f3, final float f4, final float f5) {
super.render((Entity) null, f, f1, f2, f3, f4, f5);
this.setRotationAngles(f, f1, f2, f3, f4, f5);
this.Base.render(f5);
this.Body.render(f5);
this.Arm1.render(f5);
this.Arm2.render(f5);
this.Arm3.render(f5);
this.Arm4.render(f5);
this.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(final ModelRenderer model, final float x, final float y, final float z) {
private void setRotation(ModelRenderer model, float x, float y, float z) {
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(final float f, final float f1, final float f2, final float f3, final float f4, final float f5) {
super.setRotationAngles(f, f1, f2, f3, f4, f5, (Entity) 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);
}
}
@@ -1,39 +1,38 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import net.minecraft.item.Item;
import net.minecraft.init.Items;
import binnie.core.BinnieCore;
import net.minecraft.item.crafting.IRecipe;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraft.init.Blocks;
import net.minecraftforge.oredict.OreDictionary;
import binnie.genetics.item.GeneticsItems;
import binnie.core.Mods;
import binnie.genetics.CreativeTabGenetics;
import binnie.core.machines.MachineGroup;
import binnie.genetics.Genetics;
import binnie.core.machines.inventory.ValidatorIcon;
import binnie.core.IInitializable;
import binnie.core.Mods;
import binnie.core.machines.MachineGroup;
import binnie.core.machines.inventory.ValidatorIcon;
import binnie.genetics.CreativeTabGenetics;
import binnie.genetics.Genetics;
import binnie.genetics.item.GeneticsItems;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
public class ModuleMachine implements IInitializable
{
public class ModuleMachine implements IInitializable {
public static ValidatorIcon IconDye;
static ValidatorIcon IconSequencer;
static ValidatorIcon IconSerum;
static ValidatorIcon IconEnzyme;
public static ValidatorIcon IconDye;
static ValidatorIcon IconBacteria;
static ValidatorIcon IconNugget;
@Override
public void preInit() {
(Genetics.packageGenetic = new MachineGroup(Genetics.instance, "machine", "machine", GeneticMachine.values())).setCreativeTab(CreativeTabGenetics.instance);
(Genetics.packageLabMachine = new MachineGroup(Genetics.instance, "labMachine", "labMachine", LaboratoryMachine.values())).setCreativeTab(CreativeTabGenetics.instance);
(Genetics.packageAdvGenetic = new MachineGroup(Genetics.instance, "advMachine", "advMachine", AdvGeneticMachine.values())).setCreativeTab(CreativeTabGenetics.instance);
Genetics.packageGenetic = new MachineGroup(Genetics.instance, "machine", "machine", GeneticMachine.values());
Genetics.packageGenetic.setCreativeTab(CreativeTabGenetics.instance);
Genetics.packageLabMachine = new MachineGroup(Genetics.instance, "labMachine", "labMachine", LaboratoryMachine.values());
Genetics.packageLabMachine.setCreativeTab(CreativeTabGenetics.instance);
Genetics.packageAdvGenetic = new MachineGroup(Genetics.instance, "advMachine", "advMachine", AdvGeneticMachine.values());
Genetics.packageAdvGenetic.setCreativeTab(CreativeTabGenetics.instance);
}
@Override
@@ -50,36 +49,145 @@ public class ModuleMachine implements IInitializable
@Override
public void postInit() {
Acclimatiser.setupRecipes();
final Object[] standardCircuit = { Mods.Forestry.stack("chipsets", 1, 1) };
final Object[] advCircuit = { GeneticsItems.IntegratedCircuit.get(1) };
final String ironGear = OreDictionary.getOres("gearIron").isEmpty() ? "gearIron" : "ingotIron";
final String goldGear = OreDictionary.getOres("gearGold").isEmpty() ? "gearIron" : "ingotIron";
final String diamondGear = OreDictionary.getOres("gearDiamond").isEmpty() ? "gearIron" : "ingotIron";
for (final 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 }));
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
}
));
Item alyzer = null;
if (BinnieCore.isApicultureActive()) {
alyzer = Mods.Forestry.item("beealyzer");
}
else if (BinnieCore.isArboricultureActive()) {
} else if (BinnieCore.isArboricultureActive()) {
alyzer = Mods.Forestry.item("treealyzer");
}
else if (BinnieCore.isArboricultureActive()) {
} 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) }));
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 (final 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
}
));
}
}
@@ -1,93 +1,88 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import net.minecraft.client.particle.EntityFX;
import binnie.core.BinnieCore;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.TileEntityMachine;
import binnie.core.machines.component.IRender;
import binnie.core.machines.inventory.ComponentChargedSlots;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.ComponentTankContainer;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.inventory.Validator;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import binnie.genetics.api.IItemChargable;
import binnie.genetics.core.GeneticsGUI;
import binnie.genetics.core.GeneticsTexture;
import binnie.genetics.genetics.Engineering;
import binnie.genetics.item.GeneticLiquid;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.world.World;
import binnie.core.machines.component.IRender;
import binnie.core.machines.MachineComponent;
import binnie.genetics.api.IItemChargable;
import binnie.core.machines.power.ErrorState;
import binnie.genetics.genetics.Engineering;
import binnie.core.machines.power.IProcess;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.TileEntityMachine;
import net.minecraft.tileentity.TileEntity;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.inventory.ComponentChargedSlots;
import binnie.genetics.item.GeneticLiquid;
import net.minecraftforge.fluids.FluidStack;
import binnie.core.machines.inventory.ComponentTankContainer;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.Validator;
import binnie.core.machines.inventory.SlotValidator;
import net.minecraft.item.ItemStack;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.init.Items;
import binnie.core.machines.IMachine;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.genetics.core.GeneticsGUI;
import binnie.core.machines.Machine;
import binnie.genetics.core.GeneticsTexture;
import binnie.core.craftgui.minecraft.IMachineInformation;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
public class Polymeriser
{
public static final int tankBacteria = 0;
public static final int tankDNA = 1;
public static final int slotSerum = 0;
public static final int slotGold = 1;
public static final int[] slotSerumReserve;
public static final int[] slotSerumFinished;
import java.util.Random;
static {
slotSerumReserve = new int[] { 2, 3, 4, 5 };
slotSerumFinished = new int[] { 6, 7, 8, 9 };
}
public class Polymeriser {
public static int tankBacteria = 0;
public static int tankDNA = 1;
public static int slotSerum = 0;
public static int slotGold = 1;
public static int[] slotSerumReserve = new int[]{2, 3, 4, 5};
public static int[] slotSerumFinished = new int[]{6, 7, 8, 9};
public static class PackagePolymeriser extends GeneticMachine.PackageGeneticBase implements IMachineInformation
{
public static class PackagePolymeriser extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
public PackagePolymeriser() {
super("polymeriser", GeneticsTexture.Polymeriser, 58819, true);
}
@Override
public void createMachine(final Machine machine) {
public void createMachine(Machine machine) {
new ComponentGeneticGUI(machine, GeneticsGUI.Replicator);
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
inventory.addSlot(1, "catalyst");
inventory.getSlot(1).setValidator(new SlotValidator.Item(new ItemStack(Items.gold_nugget, 1), ModuleMachine.IconNugget));
inventory.getSlot(1).forbidExtraction();
inventory.addSlot(0, "process");
inventory.getSlot(0).setValidator(new SlotValidatorUnfilledSerum());
inventory.getSlot(0).forbidInteraction();
inventory.getSlot(0).setReadOnly();
for (final InventorySlot slot : inventory.addSlotArray(Polymeriser.slotSerumReserve, "input")) {
for (InventorySlot slot : inventory.addSlotArray(Polymeriser.slotSerumReserve, "input")) {
slot.setValidator(new SlotValidatorUnfilledSerum());
slot.forbidExtraction();
}
for (final InventorySlot slot : inventory.addSlotArray(Polymeriser.slotSerumFinished, "output")) {
for (InventorySlot slot : inventory.addSlotArray(Polymeriser.slotSerumFinished, "output")) {
slot.setReadOnly();
}
final ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
transfer.addRestock(Polymeriser.slotSerumReserve, 0, 1);
transfer.addStorage(0, Polymeriser.slotSerumFinished, new ComponentInventoryTransfer.Condition() {
@Override
public boolean fufilled(final ItemStack stack) {
public boolean fufilled(ItemStack stack) {
return !stack.isItemDamaged();
}
});
final ComponentTankContainer tank = new ComponentTankContainer(machine);
ComponentTankContainer tank = new ComponentTankContainer(machine);
tank.addTank(0, "input", 1000);
tank.getTankSlot(0).setValidator(new Validator<FluidStack>() {
@Override
public boolean isValid(final FluidStack itemStack) {
public boolean isValid(FluidStack itemStack) {
return GeneticLiquid.BacteriaPoly.get(1).isFluidEqual(itemStack);
}
@@ -96,10 +91,11 @@ public class Polymeriser
return "Polymerising Bacteria";
}
});
tank.addTank(1, "input", 1000);
tank.getTankSlot(1).setValidator(new Validator<FluidStack>() {
@Override
public boolean isValid(final FluidStack itemStack) {
public boolean isValid(FluidStack itemStack) {
return GeneticLiquid.RawDNA.get(1).isFluidEqual(itemStack);
}
@@ -108,6 +104,7 @@ public class Polymeriser
return "Raw DNA";
}
});
new ComponentChargedSlots(machine).addCharge(1);
new ComponentPowerReceptor(machine, 8000);
new ComponentPolymeriserLogic(machine);
@@ -118,60 +115,58 @@ public class Polymeriser
public TileEntity createTileEntity() {
return new TileEntityMachine(this);
}
@Override
public void register() {
}
}
public static class ComponentPolymeriserLogic extends ComponentProcessSetCost implements IProcess
{
private static float chargePerProcess;
public static class ComponentPolymeriserLogic extends ComponentProcessSetCost implements IProcess {
private static float chargePerProcess = 0.4f;
private float dnaDrain;
private float bacteriaDrain;
public ComponentPolymeriserLogic(final Machine machine) {
public ComponentPolymeriserLogic(Machine machine) {
super(machine, 96000, 2400);
this.dnaDrain = 0.0f;
this.bacteriaDrain = 0.0f;
dnaDrain = 0.0f;
bacteriaDrain = 0.0f;
}
private float getCatalyst() {
return (this.getUtil().getSlotCharge(1) > 0.0f) ? 0.2f : 1.0f;
return (getUtil().getSlotCharge(1) > 0.0f) ? 0.2f : 1.0f;
}
@Override
public int getProcessLength() {
return (int) (super.getProcessLength() * this.getNumberOfGenes() * this.getCatalyst());
return (int) (super.getProcessLength() * getNumberOfGenes() * getCatalyst());
}
@Override
public int getProcessEnergy() {
return (int) (super.getProcessEnergy() * this.getNumberOfGenes() * this.getCatalyst());
return (int) (super.getProcessEnergy() * getNumberOfGenes() * getCatalyst());
}
private float getDNAPerProcess() {
return this.getNumberOfGenes() * 50;
return getNumberOfGenes() * 50;
}
@Override
public void onTickTask() {
super.onTickTask();
this.getUtil().useCharge(1, ComponentPolymeriserLogic.chargePerProcess * this.getProgressPerTick() / 100.0f);
this.dnaDrain += this.getDNAPerProcess() * this.getProgressPerTick() / 100.0f;
this.bacteriaDrain += 0.2f * this.getDNAPerProcess() * this.getProgressPerTick() / 100.0f;
if (this.dnaDrain >= 1.0f) {
this.getUtil().drainTank(1, 1);
--this.dnaDrain;
getUtil().useCharge(1, ComponentPolymeriserLogic.chargePerProcess * getProgressPerTick() / 100.0f);
dnaDrain += getDNAPerProcess() * getProgressPerTick() / 100.0f;
bacteriaDrain += 0.2f * getDNAPerProcess() * getProgressPerTick() / 100.0f;
if (dnaDrain >= 1.0f) {
getUtil().drainTank(1, 1);
dnaDrain--;
}
if (this.bacteriaDrain >= 1.0f) {
this.getUtil().drainTank(0, 1);
--this.bacteriaDrain;
if (bacteriaDrain >= 1.0f) {
getUtil().drainTank(0, 1);
bacteriaDrain--;
}
}
private int getNumberOfGenes() {
final ItemStack serum = this.getUtil().getStack(0);
ItemStack serum = getUtil().getStack(0);
if (serum == null) {
return 1;
}
@@ -180,16 +175,16 @@ public class Polymeriser
@Override
public String getTooltip() {
final int n = this.getNumberOfGenes();
int n = getNumberOfGenes();
return "Replicating " + n + " genes" + ((n > 1) ? "s" : "");
}
@Override
public ErrorState canWork() {
if (this.getUtil().isSlotEmpty(0)) {
if (getUtil().isSlotEmpty(0)) {
return new ErrorState.NoItem("No item to replicate", 0);
}
if (!this.getUtil().getStack(0).isItemDamaged()) {
if (!getUtil().getStack(0).isItemDamaged()) {
return new ErrorState.InvalidItem("Item filled", 0);
}
return super.canWork();
@@ -197,10 +192,10 @@ public class Polymeriser
@Override
public ErrorState canProgress() {
if (this.getUtil().getFluid(0) == null) {
if (getUtil().getFluid(0) == null) {
return new ErrorState.InsufficientLiquid("Insufficient Bacteria", 0);
}
if (this.getUtil().getFluid(1) == null) {
if (getUtil().getFluid(1) == null) {
return new ErrorState.InsufficientLiquid("Insufficient DNA", 1);
}
return super.canProgress();
@@ -209,22 +204,17 @@ public class Polymeriser
@Override
protected void onFinishTask() {
super.onFinishTask();
this.getUtil().damageItem(0, -1);
}
static {
ComponentPolymeriserLogic.chargePerProcess = 0.4f;
getUtil().damageItem(0, -1);
}
}
public static class SlotValidatorUnfilledSerum extends SlotValidator
{
public static class SlotValidatorUnfilledSerum extends SlotValidator {
public SlotValidatorUnfilledSerum() {
super(ModuleMachine.IconSerum);
}
@Override
public boolean isValid(final ItemStack itemStack) {
public boolean isValid(ItemStack itemStack) {
return itemStack.getItem() instanceof IItemChargable;
}
@@ -234,60 +224,59 @@ public class Polymeriser
}
}
public static class ComponentPolymeriserFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick
{
public ComponentPolymeriserFX(final IMachine machine) {
public static class ComponentPolymeriserFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
public ComponentPolymeriserFX(IMachine machine) {
super(machine);
}
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
}
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 8L);
if ((tick == 0 || tick == 3) && this.getUtil().getProcess().isInProgress()) {
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 = this.posX;
double axisZ = this.posZ;
double angle = 0.7 + (int) (this.worldObj.getTotalWorldTime() % 2L) * 3.1415;
double axisX = posX;
double axisZ = posZ;
double angle = 0.7 + (int) (worldObj.getTotalWorldTime() % 2L) * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = -0.006;
this.particleMaxAge = 140;
this.particleGravity = 0.0f;
this.noClip = true;
this.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();
this.angle += 0.1;
this.motionY = -0.006;
angle += 0.1;
motionY = -0.006;
double dist = 0.2;
if (this.particleAge > 60) {
if (this.particleAge > 120) {
if (particleAge > 60) {
if (particleAge > 120) {
dist = 0.1;
}
else {
dist = 0.2 - 0.1 * ((this.particleAge - 60.0f) / 60.0f);
} else {
dist = 0.2 - 0.1 * ((particleAge - 60.0f) / 60.0f);
}
}
this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
if (this.particleAge <= 40) {
this.setAlphaF(this.particleAge / 40.0f);
setPosition(axisX + dist * Math.sin(angle), posY, axisZ + dist * Math.cos(angle));
if (particleAge <= 40) {
setAlphaF(particleAge / 40.0f);
}
if (this.particleAge > 80) {
this.setRBGColorF(this.particleRed + (0.0f - this.particleRed) / 10.0f, this.particleGreen + (1.0f - this.particleGreen) / 10.0f, this.particleBlue + (1.0f - this.particleBlue) / 10.0f);
if (particleAge > 80) {
setRBGColorF(particleRed + (0.0f - particleRed) / 10.0f, particleGreen + (1.0f - particleGreen) / 10.0f, particleBlue + (1.0f - particleBlue) / 10.0f);
}
}
@@ -1,58 +1,49 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import binnie.Binnie;
import binnie.core.BinnieCore;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.TileEntityMachine;
import binnie.core.machines.component.IRender;
import binnie.core.machines.inventory.ComponentChargedSlots;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.power.ComponentProcess;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import binnie.core.resource.BinnieIcon;
import binnie.genetics.Genetics;
import binnie.genetics.core.GeneticsGUI;
import binnie.genetics.core.GeneticsTexture;
import binnie.genetics.genetics.GeneTracker;
import binnie.genetics.genetics.SequencerItem;
import binnie.genetics.item.GeneticsItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.particle.EntityFX;
import binnie.core.BinnieCore;
import java.util.Random;
import net.minecraft.world.World;
import binnie.core.machines.component.IRender;
import binnie.core.machines.MachineComponent;
import binnie.genetics.genetics.GeneTracker;
import binnie.genetics.genetics.SequencerItem;
import binnie.core.machines.power.ErrorState;
import net.minecraft.item.ItemStack;
import binnie.core.machines.power.IProcess;
import binnie.core.machines.power.ComponentProcess;
import binnie.core.machines.TileEntityMachine;
import net.minecraft.tileentity.TileEntity;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.inventory.ComponentChargedSlots;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.SlotValidator;
import binnie.genetics.item.GeneticsItems;
import binnie.core.machines.IMachine;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.genetics.core.GeneticsGUI;
import binnie.core.machines.Machine;
import binnie.genetics.Genetics;
import binnie.Binnie;
import binnie.genetics.core.GeneticsTexture;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.resource.BinnieIcon;
import net.minecraft.world.World;
public class Sequencer
{
public static final int slotDye = 0;
public static final int[] slotReserve;
public static final int slotTarget = 5;
public static final int slotDone = 6;
import java.util.Random;
public class Sequencer {
public static int[] slotReserve = new int[]{1, 2, 3, 4};
public static int slotDye = 0;
public static int slotTarget = 5;
public static int slotDone = 6;
public static BinnieIcon fxSeqA;
public static BinnieIcon fxSeqG;
public static BinnieIcon fxSeqT;
public static BinnieIcon fxSeqC;
static {
slotReserve = new int[] { 1, 2, 3, 4 };
}
public static class PackageSequencer extends GeneticMachine.PackageGeneticBase implements IMachineInformation
{
public static class PackageSequencer extends GeneticMachine.PackageGeneticBase implements IMachineInformation {
public PackageSequencer() {
super("sequencer", GeneticsTexture.Sequencer, 12058418, true);
Sequencer.fxSeqA = Binnie.Resource.getBlockIcon(Genetics.instance, "fx/sequencer.a");
@@ -62,24 +53,28 @@ public class Sequencer
}
@Override
public void createMachine(final Machine machine) {
public void createMachine(Machine machine) {
new ComponentGeneticGUI(machine, GeneticsGUI.Sequencer);
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
inventory.addSlot(0, "dye");
inventory.getSlot(0).setValidator(new SlotValidator.Item(GeneticsItems.FluorescentDye.get(1), ModuleMachine.IconDye));
inventory.getSlot(0).forbidExtraction();
inventory.addSlotArray(Sequencer.slotReserve, "input");
for (final InventorySlot slot : inventory.getSlots(Sequencer.slotReserve)) {
for (InventorySlot slot : inventory.getSlots(Sequencer.slotReserve)) {
slot.setValidator(new SlotValidatorUnsequenced());
slot.forbidExtraction();
}
inventory.addSlot(5, "process");
inventory.getSlot(5).setValidator(new SlotValidatorUnsequenced());
inventory.getSlot(5).setReadOnly();
inventory.getSlot(5).forbidInteraction();
inventory.addSlot(6, "output");
inventory.getSlot(6).setReadOnly();
final ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
transfer.addRestock(Sequencer.slotReserve, 5, 1);
new ComponentChargedSlots(machine).addCharge(0);
new ComponentPowerReceptor(machine, 10000);
@@ -91,40 +86,35 @@ public class Sequencer
public TileEntity createTileEntity() {
return new TileEntityMachine(this);
}
@Override
public void register() {
}
}
public static class ComponentSequencerLogic extends ComponentProcess implements IProcess
{
public ComponentSequencerLogic(final Machine machine) {
public static class ComponentSequencerLogic extends ComponentProcess implements IProcess {
public ComponentSequencerLogic(Machine machine) {
super(machine);
}
public float getSequenceStrength() {
final ItemStack stack = this.getUtil().getStack(5);
ItemStack stack = getUtil().getStack(5);
if (stack == null) {
return 1.0f;
}
final float mult = 1.0f - stack.getItemDamage() % 6 / 5.0f;
float mult = 1.0f - stack.getItemDamage() % 6 / 5.0f;
return 1.0f - mult * mult * 0.75f;
}
@Override
public int getProcessLength() {
return (int) (19200.0f * this.getSequenceStrength());
return (int) (19200.0f * getSequenceStrength());
}
@Override
public int getProcessEnergy() {
return this.getProcessLength() * 20;
return getProcessLength() * 20;
}
@Override
public ErrorState canWork() {
if (this.getUtil().isSlotEmpty(5)) {
if (getUtil().isSlotEmpty(5)) {
return new ErrorState.NoItem("No DNA sequence", 5);
}
return super.canWork();
@@ -132,14 +122,14 @@ public class Sequencer
@Override
public ErrorState canProgress() {
if (this.getMachine().getOwner() == null) {
if (getMachine().getOwner() == null) {
return new ErrorState("No Owner", "Replace this block to claim this machine");
}
if (this.getUtil().getSlotCharge(0) == 0.0f) {
if (getUtil().getSlotCharge(0) == 0.0f) {
return new ErrorState.NoItem("Insufficient Dye", 0);
}
if (this.getUtil().getStack(6) != null && this.getUtil().getStack(6).stackSize >= 64) {
return new ErrorState.NoSpace("No space for empty sequences", new int[] { 6 });
if (getUtil().getStack(6) != null && getUtil().getStack(6).stackSize >= 64) {
return new ErrorState.NoSpace("No space for empty sequences", new int[]{6});
}
return super.canProgress();
}
@@ -147,40 +137,40 @@ public class Sequencer
@Override
protected void onStartTask() {
super.onStartTask();
final ItemStack item = this.getUtil().getStack(5);
final SequencerItem seqItem = new SequencerItem(item);
final int seq = seqItem.sequenced;
ItemStack item = getUtil().getStack(5);
SequencerItem seqItem = new SequencerItem(item);
int seq = seqItem.sequenced;
if (seq != 0) {
this.setProgress(seq);
setProgress(seq);
}
}
@Override
protected void onFinishTask() {
super.onFinishTask();
this.updateSequence();
final SequencerItem seqItem = new SequencerItem(this.getUtil().getStack(5));
GeneTracker.getTracker(this.getMachine().getWorld(), this.getMachine().getOwner()).registerGene(seqItem.getGene());
this.getUtil().decreaseStack(5, 1);
if (this.getUtil().getStack(6) == null) {
this.getUtil().setStack(6, GeneticsItems.EmptySequencer.get(1));
}
else {
this.getUtil().decreaseStack(6, -1);
updateSequence();
SequencerItem seqItem = new SequencerItem(getUtil().getStack(5));
GeneTracker.getTracker(getMachine().getWorld(), getMachine().getOwner()).registerGene(seqItem.getGene());
getUtil().decreaseStack(5, 1);
if (getUtil().getStack(6) == null) {
getUtil().setStack(6, GeneticsItems.EmptySequencer.get(1));
} else {
getUtil().decreaseStack(6, -1);
}
}
@Override
protected void onTickTask() {
this.updateSequence();
this.getUtil().useCharge(0, 0.4f * this.getProgressPerTick() / 100.0f);
updateSequence();
getUtil().useCharge(0, 0.4f * getProgressPerTick() / 100.0f);
}
private void updateSequence() {
final int prog = (int) this.getProgress();
final ItemStack item = this.getUtil().getStack(5);
final SequencerItem seqItem = new SequencerItem(item);
final int seq = seqItem.sequenced;
int prog = (int) getProgress();
ItemStack item = getUtil().getStack(5);
SequencerItem seqItem = new SequencerItem(item);
int seq = seqItem.sequenced;
if (prog != seq) {
seqItem.sequenced = prog;
seqItem.writeToItem(item);
@@ -188,43 +178,42 @@ public class Sequencer
}
}
public static class ComponentSequencerFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick
{
public ComponentSequencerFX(final IMachine machine) {
public static class ComponentSequencerFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
public ComponentSequencerFX(IMachine machine) {
super(machine);
}
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
if (!this.getUtil().getProcess().isInProgress()) {
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 = this.posX;
double axisZ = this.posZ;
double angle = this.rand.nextDouble() * 2.0 * 3.1415;
double axisX = posX;
double axisZ = posZ;
double angle = rand.nextDouble() * 2.0 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.0;
this.particleMaxAge = 200;
this.particleGravity = 0.0f;
this.noClip = true;
this.setRBGColorF(0.6f + this.rand.nextFloat() * 0.2f, 1.0f, 0.8f * this.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();
this.angle += 0.03;
this.setPosition(this.axisX + 0.4 * Math.sin(this.angle), this.posY, this.axisZ + 0.4 * Math.cos(this.angle));
this.motionY = 0.0;
this.setAlphaF((float) Math.sin(3.14 * this.particleAge / this.particleMaxAge));
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
@@ -236,31 +225,27 @@ public class Sequencer
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
final int ticks = (int) (world.getTotalWorldTime() % 16L);
if (ticks == 0 && this.getUtil().getProcess().isInProgress()) {
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()) {
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0) {
double axisX = 0.0;
double axisZ = 0.0;
double angle = 0.0;
{
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.012;
this.particleMaxAge = 50;
this.particleGravity = 0.0f;
this.noClip = true;
this.particleScale = 2.0f;
this.setParticleIcon((new BinnieIcon[] { Sequencer.fxSeqA, Sequencer.fxSeqG, Sequencer.fxSeqC, Sequencer.fxSeqT })[this.rand.nextInt(4)].getIcon());
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());
}
@Override
public void onUpdate() {
super.onUpdate();
this.motionY = 0.012;
if (this.particleAge > 40) {
this.setAlphaF((50 - this.particleAge) / 10.0f);
motionY = 0.012;
if (particleAge > 40) {
setAlphaF((50 - particleAge) / 10.0f);
}
}
@@ -273,16 +258,15 @@ public class Sequencer
}
}
public static class SlotValidatorUnsequenced extends SlotValidator
{
public static class SlotValidatorUnsequenced extends SlotValidator {
public SlotValidatorUnsequenced() {
super(ModuleMachine.IconSequencer);
}
@Override
public boolean isValid(final ItemStack itemStack) {
public boolean isValid(ItemStack itemStack) {
if (itemStack.getItem() == Genetics.itemSequencer) {
final SequencerItem seq = new SequencerItem(itemStack);
SequencerItem seq = new SequencerItem(itemStack);
return seq.sequenced < 100;
}
return false;
@@ -1,16 +1,12 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import net.minecraft.item.ItemStack;
import binnie.core.machines.inventory.Validator;
import net.minecraft.item.ItemStack;
public class SlotValidatorInoculatorCatalyst extends Validator<ItemStack>
{
// TODO unused class?
public class SlotValidatorInoculatorCatalyst extends Validator<ItemStack> {
@Override
public boolean isValid(final ItemStack itemStack) {
public boolean isValid(ItemStack itemStack) {
return false;
}
+181 -173
View File
@@ -1,101 +1,92 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.machine;
import forestry.api.genetics.ISpeciesRoot;
import binnie.Binnie;
import net.minecraft.entity.player.EntityPlayer;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.particle.EntityFX;
import binnie.core.BinnieCore;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.TileEntityMachine;
import binnie.core.machines.component.IRender;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.network.INetwork;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import binnie.genetics.api.IGene;
import binnie.genetics.api.IItemSerum;
import binnie.genetics.core.GeneticsGUI;
import binnie.genetics.core.GeneticsTexture;
import binnie.genetics.genetics.Engineering;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.entity.item.EntityItem;
import binnie.core.machines.network.INetwork;
import binnie.core.machines.component.IRender;
import binnie.core.machines.MachineComponent;
import binnie.core.machines.power.ErrorState;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.AlleleManager;
import binnie.core.machines.power.IProcess;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.TileEntityMachine;
import net.minecraft.tileentity.TileEntity;
import binnie.core.machines.inventory.InventorySlot;
import binnie.core.machines.power.ComponentPowerReceptor;
import binnie.genetics.genetics.Engineering;
import binnie.core.machines.inventory.ComponentInventoryTransfer;
import binnie.genetics.api.IItemSerum;
import binnie.core.machines.inventory.SlotValidator;
import binnie.core.machines.IMachine;
import binnie.core.machines.inventory.ComponentInventorySlots;
import binnie.genetics.core.GeneticsGUI;
import binnie.core.machines.Machine;
import binnie.genetics.core.GeneticsTexture;
import binnie.core.craftgui.minecraft.IMachineInformation;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagCompound;
import forestry.api.genetics.IAllele;
import forestry.api.apiculture.IBeeRoot;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IBeeRoot;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import binnie.genetics.api.IGene;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
public class Splicer
{
public static final int slotSerumVial = 0;
public static final int[] slotSerumReserve;
public static final int[] slotSerumExpended;
public static final int[] slotReserve;
public static final int slotTarget = 9;
public static final int[] slotFinished;
import java.util.Random;
public static void setGene(final IGene gene, final ItemStack target, final int chromoN) {
int chromosomeID;
final int chromosome = chromosomeID = gene.getChromosome().ordinal();
public class Splicer {
public static int slotSerumVial = 0;
public static int[] slotSerumReserve = new int[]{1, 2};
public static int[] slotSerumExpended = new int[]{3, 4};
public static int[] slotReserve = new int[]{5, 6, 7, 8, 9};
public static int slotTarget = 9;
public static int[] slotFinished = new int[]{10, 11, 12, 13};
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;
chromosomeID--;
}
final Class<? extends IAllele> cls = gene.getChromosome().getAlleleClass();
Class<? extends IAllele> cls = gene.getChromosome().getAlleleClass();
if (!cls.isInstance(gene.getAllele())) {
return;
}
final NBTTagCompound beeNBT = target.getTagCompound();
final NBTTagCompound genomeNBT = beeNBT.getCompoundTag("Genome");
final NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
final NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
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);
}
static {
slotSerumReserve = new int[] { 1, 2 };
slotSerumExpended = new int[] { 3, 4 };
slotReserve = new int[] { 5, 6, 7, 8, 9 };
slotFinished = new int[] { 10, 11, 12, 13 };
}
public static class PackageSplicer extends AdvGeneticMachine.PackageAdvGeneticBase implements IMachineInformation
{
public static class PackageSplicer extends AdvGeneticMachine.PackageAdvGeneticBase implements IMachineInformation {
public PackageSplicer() {
super("splicer", GeneticsTexture.Splicer, 14819893, true);
}
@Override
public void createMachine(final Machine machine) {
public void createMachine(Machine machine) {
new ComponentGeneticGUI(machine, GeneticsGUI.Splicer);
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
inventory.addSlot(0, "serum.active");
inventory.getSlot(0).forbidInteraction();
inventory.getSlot(0).setReadOnly();
final SlotValidator serumValid = new SlotValidator(ModuleMachine.IconSerum) {
SlotValidator serumValid = new SlotValidator(ModuleMachine.IconSerum) {
@Override
public boolean isValid(final ItemStack itemStack) {
public boolean isValid(ItemStack itemStack) {
return itemStack.getItem() instanceof IItemSerum;
}
@@ -104,47 +95,55 @@ public class Splicer
return "Serum Vials & Arrays";
}
};
inventory.getSlot(0).setValidator(serumValid);
inventory.addSlotArray(Splicer.slotSerumReserve, "serum.input");
for (final InventorySlot slot : inventory.getSlots(Splicer.slotSerumReserve)) {
for (InventorySlot slot : inventory.getSlots(Splicer.slotSerumReserve)) {
slot.setValidator(serumValid);
slot.forbidExtraction();
}
inventory.addSlotArray(Splicer.slotSerumExpended, "serum.output");
for (final InventorySlot slot : inventory.getSlots(Splicer.slotSerumExpended)) {
for (InventorySlot slot : inventory.getSlots(Splicer.slotSerumExpended)) {
slot.setValidator(serumValid);
slot.setReadOnly();
}
inventory.addSlotArray(Splicer.slotReserve, "input");
for (final InventorySlot slot : inventory.getSlots(Splicer.slotReserve)) {
for (InventorySlot slot : inventory.getSlots(Splicer.slotReserve)) {
slot.forbidExtraction();
slot.setValidator(new ValidatorIndividualInoculate());
}
inventory.addSlot(9, "process");
inventory.getSlot(9).setValidator(new ValidatorIndividualInoculate());
inventory.getSlot(9).setReadOnly();
inventory.getSlot(9).forbidInteraction();
inventory.addSlotArray(Splicer.slotFinished, "output");
for (final InventorySlot slot : inventory.getSlots(Splicer.slotFinished)) {
for (InventorySlot slot : inventory.getSlots(Splicer.slotFinished)) {
slot.setReadOnly();
slot.forbidInsertion();
slot.setValidator(new ValidatorIndividualInoculate());
}
final ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
transfer.addRestock(Splicer.slotReserve, 9, 1);
transfer.addRestock(Splicer.slotSerumReserve, 0);
transfer.addStorage(0, Splicer.slotSerumExpended, new ComponentInventoryTransfer.Condition() {
@Override
public boolean fufilled(final ItemStack stack) {
public boolean fufilled(ItemStack stack) {
return Engineering.getCharges(stack) == 0;
}
});
transfer.addStorage(9, Splicer.slotFinished, new ComponentInventoryTransfer.Condition() {
@Override
public boolean fufilled(final ItemStack stack) {
return stack != null && this.transfer.getMachine().getMachineUtil().getStack(0) != null && this.transfer.getMachine().getInterface(ComponentSplicerLogic.class).isValidSerum() != null;
public boolean fufilled(ItemStack stack) {
return stack != null
&& transfer.getMachine().getMachineUtil().getStack(0) != null
&& transfer.getMachine().getInterface(ComponentSplicerLogic.class).isValidSerum() != null;
}
});
new ComponentPowerReceptor(machine, 20000);
new ComponentSplicerLogic(machine);
new ComponentSplicerFX(machine);
@@ -154,19 +153,19 @@ public class Splicer
public TileEntity createTileEntity() {
return new TileEntityMachine(this);
}
@Override
public void register() {
}
}
public static class ComponentSplicerLogic extends ComponentProcessSetCost implements IProcess
{
public static class ComponentSplicerLogic extends ComponentProcessSetCost implements IProcess {
int nOfGenes;
public ComponentSplicerLogic(Machine machine) {
super(machine, 12000000, 1200);
nOfGenes = 0;
}
@Override
public int getProcessLength() {
float n = this.getNumberOfGenes();
float n = getNumberOfGenes();
if (n > 1.0f) {
n = 1.0f + (n - 1.0f) * 0.5f;
}
@@ -177,7 +176,7 @@ public class Splicer
@Override
public int getProcessEnergy() {
float n = this.getNumberOfGenes();
float n = getNumberOfGenes();
if (n > 1.0f) {
n = 1.0f + (n - 1.0f) * 0.5f;
}
@@ -187,31 +186,33 @@ public class Splicer
@Override
public void onInventoryUpdate() {
super.onInventoryUpdate();
this.nOfGenes = this.getGenesToUse();
nOfGenes = getGenesToUse();
}
protected int getGenesToUse() {
final ItemStack serum = this.getUtil().getStack(0);
final ItemStack target = this.getUtil().getStack(9);
ItemStack serum = getUtil().getStack(0);
ItemStack target = getUtil().getStack(9);
if (serum == null || target == null) {
return 1;
}
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
final IGene[] genes = ((IItemSerum) serum.getItem()).getGenes(serum);
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 (final IGene gene : genes) {
for (IGene gene : genes) {
if (ind.getGenome().getActiveAllele(gene.getChromosome()) != gene.getAllele() || ind.getGenome().getInactiveAllele(gene.getChromosome()) != gene.getAllele()) {
++i;
i++;
}
}
return (i < 1) ? 1 : i;
}
private int getFullNumberOfGenes() {
final ItemStack serum = this.getUtil().getStack(0);
ItemStack serum = getUtil().getStack(0);
if (serum == null) {
return 1;
}
@@ -219,58 +220,61 @@ public class Splicer
}
private int getNumberOfGenes() {
return this.nOfGenes;
return nOfGenes;
}
@Override
public String getTooltip() {
final int n = this.getNumberOfGenes();
final int f = this.getFullNumberOfGenes();
int n = getNumberOfGenes();
int f = getFullNumberOfGenes();
return "Splicing in " + n + ((f > 1) ? ("/" + f) : "") + " gene" + ((n > 1) ? "s" : "");
}
public ComponentSplicerLogic(final Machine machine) {
super(machine, 12000000, 1200);
this.nOfGenes = 0;
}
@Override
public ErrorState canWork() {
if (this.getUtil().isSlotEmpty(9)) {
if (getUtil().isSlotEmpty(9)) {
return new ErrorState.NoItem("No Individual to Splice", 9);
}
if (this.getUtil().isSlotEmpty(0)) {
if (getUtil().isSlotEmpty(0)) {
return new ErrorState.NoItem("No Serum", 0);
}
final ErrorState state = this.isValidSerum();
ErrorState state = isValidSerum();
if (state != null) {
return state;
}
if (this.getUtil().getStack(0) != null && Engineering.getCharges(this.getUtil().getStack(0)) == 0) {
if (getUtil().getStack(0) != null && Engineering.getCharges(getUtil().getStack(0)) == 0) {
return new ErrorState("Empty Serum", "Serum is empty");
}
return super.canWork();
}
public ErrorState isValidSerum() {
final ItemStack serum = this.getUtil().getStack(0);
final ItemStack target = this.getUtil().getStack(9);
final IGene[] genes = Engineering.getGenes(serum);
ItemStack serum = getUtil().getStack(0);
ItemStack target = getUtil().getStack(9);
IGene[] genes = Engineering.getGenes(serum);
if (genes.length == 0) {
return new ErrorState("Invalid Serum", "Serum does not hold any genes");
}
if (!genes[0].getSpeciesRoot().isMember(target)) {
return new ErrorState("Invalid Serum", "Mismatch of Serum Type and Target");
}
final IIndividual individual = genes[0].getSpeciesRoot().getMember(target);
IIndividual individual = genes[0].getSpeciesRoot().getMember(target);
boolean hasAll = true;
for (final IGene gene : genes) {
for (IGene gene : genes) {
if (hasAll) {
final IAllele a = individual.getGenome().getActiveAllele(gene.getChromosome());
final IAllele b = individual.getGenome().getInactiveAllele(gene.getChromosome());
hasAll = (hasAll && a.getUID().equals(gene.getAllele().getUID()) && b.getUID().equals(gene.getAllele().getUID()));
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("Defunct Serum", "Individual already possesses this allele");
}
@@ -285,74 +289,78 @@ public class Splicer
@Override
protected void onFinishTask() {
super.onFinishTask();
final ItemStack serum = this.getUtil().getStack(0);
final ItemStack target = this.getUtil().getStack(9);
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
ItemStack serum = getUtil().getStack(0);
ItemStack target = getUtil().getStack(9);
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(target);
if (!ind.isAnalyzed()) {
ind.analyze();
final NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTTagCompound nbttagcompound = new NBTTagCompound();
ind.writeToNBT(nbttagcompound);
target.setTagCompound(nbttagcompound);
}
final IGene[] arr$;
final IGene[] genes = arr$ = ((IItemSerum) serum.getItem()).getGenes(serum);
for (final IGene gene : arr$) {
IGene[] genes = ((IItemSerum) serum.getItem()).getGenes(serum);
for (IGene gene : genes) {
Splicer.setGene(gene, target, 0);
Splicer.setGene(gene, target, 1);
}
this.getUtil().damageItem(0, 1);
getUtil().damageItem(0, 1);
}
@Override
protected void onTickTask() {
// ignored
}
}
public static class ComponentSplicerFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync
{
private final EntityItem dummyEntityItem;
public static class ComponentSplicerFX extends MachineComponent implements
IRender.RandomDisplayTick,
IRender.DisplayTick,
IRender.Render,
INetwork.TilePacketSync {
private EntityItem dummyEntityItem;
public ComponentSplicerFX(final IMachine machine) {
public ComponentSplicerFX(IMachine machine) {
super(machine);
this.dummyEntityItem = new EntityItem((World) null);
dummyEntityItem = new EntityItem(null);
}
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
public void onRandomDisplayTick(World world, int x, int y, int z, Random rand) {
}
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 3L);
if (tick == 0 && this.getUtil().getProcess().isInProgress()) {
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 + 1.5, z + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = (int) (this.worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
double axisX = posX;
double axisZ = posZ;
double angle = (int) (worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = (this.rand.nextDouble() - 0.5) * 0.02;
this.particleMaxAge = 240;
this.particleGravity = 0.0f;
this.noClip = true;
this.setRBGColorF(0.3f + this.rand.nextFloat() * 0.5f, 0.3f + this.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();
final double speed = 0.04;
this.angle -= speed;
final double dist = 0.25 + 0.2 * Math.sin(this.particleAge / 50.0f);
this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
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
@@ -365,23 +373,25 @@ public class Splicer
@SideOnly(Side.CLIENT)
@Override
public void renderInWorld(final RenderItem renderItem, final double x, final double y, final double z) {
if (!this.getUtil().getProcess().isInProgress()) {
public void renderInWorld(RenderItem renderItem, double x, double y, double z) {
if (!getUtil().getProcess().isInProgress()) {
return;
}
final ItemStack stack = this.getUtil().getStack(9);
this.dummyEntityItem.worldObj = this.getMachine().getWorld();
this.dummyEntityItem.setEntityItemStack(stack);
final EntityItem dummyEntityItem = this.dummyEntityItem;
++dummyEntityItem.age;
ItemStack stack = getUtil().getStack(9);
dummyEntityItem.worldObj = getMachine().getWorld();
dummyEntityItem.setEntityItemStack(stack);
EntityItem dummyEntityItem = this.dummyEntityItem;
dummyEntityItem.age++;
this.dummyEntityItem.hoverStart = 0.0f;
if (stack == null) {
return;
}
final EntityPlayer player = BinnieCore.proxy.getPlayer();
final double dx = x + 0.5 - player.lastTickPosX;
final double dz = z + 0.5 - player.lastTickPosZ;
final double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
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.25f, 0.0f);
@@ -390,9 +400,9 @@ public class Splicer
}
@Override
public void syncToNBT(final NBTTagCompound nbt) {
final NBTTagCompound item = new NBTTagCompound();
final ItemStack stack = this.getUtil().getStack(9);
public void syncToNBT(NBTTagCompound nbt) {
NBTTagCompound item = new NBTTagCompound();
ItemStack stack = getUtil().getStack(9);
if (stack != null) {
stack.writeToNBT(item);
nbt.setTag("item", item);
@@ -400,33 +410,31 @@ public class Splicer
}
@Override
public void syncFromNBT(final NBTTagCompound nbt) {
public void syncFromNBT(NBTTagCompound nbt) {
if (nbt.hasKey("item")) {
this.getUtil().setStack(9, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
}
else {
this.getUtil().setStack(9, null);
getUtil().setStack(9, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")));
} else {
getUtil().setStack(9, null);
}
}
@Override
public void onInventoryUpdate() {
if (!this.getUtil().isServer()) {
if (!getUtil().isServer()) {
return;
}
this.getUtil().refreshBlock();
getUtil().refreshBlock();
}
}
public static class ValidatorIndividualInoculate extends SlotValidator
{
public static class ValidatorIndividualInoculate extends SlotValidator {
public ValidatorIndividualInoculate() {
super(null);
}
@Override
public boolean isValid(final ItemStack object) {
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(object);
public boolean isValid(ItemStack object) {
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(object);
return root != null && Binnie.Genetics.getSystem(root).isDNAManipulable(object);
}