mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-26 15:03:14 +00:00
More null annotations
This commit is contained in:
1 parent
da8a833485
commit
a5daa93bf1
163 files changed
+952
-849
No files matched your search
@@ -45,6 +45,7 @@ public abstract class ComponentIndexerInventory<T> extends ComponentInventory im
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getStackInSlot(final int index) {
|
||||
if (index >= 0 && index < this.indexerInventory.size()) {
|
||||
return this.indexerInventory.get(index);
|
||||
@@ -53,6 +54,7 @@ public abstract class ComponentIndexerInventory<T> extends ComponentInventory im
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack decrStackSize(final int index, final int amount) {
|
||||
ItemStack stackInSlot = this.getStackInSlot(index);
|
||||
if (stackInSlot != null) {
|
||||
|
||||
@@ -77,9 +77,6 @@ public enum LaboratoryMachine implements IMachineType {
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
return;
|
||||
}
|
||||
this.stack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Item"));
|
||||
}
|
||||
|
||||
|
||||
@@ -103,9 +103,9 @@ public class Acclimatiser {
|
||||
addHumidityItem(new ItemStack(Items.WATER_BUCKET), 0.75f);
|
||||
addHumidityItem(new ItemStack(Blocks.SAND), -0.15f);
|
||||
addTemperatureItem(FluidContainerType.CAN.getFilled(FluidRegistry.LAVA), 0.75f);
|
||||
addTemperatureItem(FluidContainerType.REFARACTORY.getFilled(FluidRegistry.LAVA), 0.75f);
|
||||
addTemperatureItem(FluidContainerType.REFRACTORY.getFilled(FluidRegistry.LAVA), 0.75f);
|
||||
addHumidityItem(FluidContainerType.CAN.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
addHumidityItem(FluidContainerType.REFARACTORY.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
addHumidityItem(FluidContainerType.REFRACTORY.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
addHumidityItem(FluidContainerType.CAPSULE.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,10 @@ public class Analyser {
|
||||
return ind != null || stack.getItem() instanceof IItemAnalysable || Binnie.GENETICS.getConversion(stack) != null;
|
||||
}
|
||||
|
||||
public static boolean isAnalysed(final ItemStack stack) {
|
||||
public static boolean isAnalysed(@Nullable final ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
|
||||
if (ind != null) {
|
||||
return ind.isAnalyzed();
|
||||
@@ -29,7 +32,11 @@ public class Analyser {
|
||||
return stack.getItem() instanceof IItemAnalysable && ((IItemAnalysable) stack.getItem()).isAnalysed(stack);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ItemStack analyse(@Nullable ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
final ItemStack conv = Binnie.GENETICS.getConversionStack(stack);
|
||||
if (conv != null) {
|
||||
stack = conv;
|
||||
|
||||
@@ -33,12 +33,12 @@ public class WindowAcclimatiser extends WindowMachine {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
final int y = 32;
|
||||
new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.SLOT_RESERVE);
|
||||
new ControlSlotArray.Builder(this, x, y, 2, 2).create(Acclimatiser.SLOT_RESERVE);
|
||||
x += 54;
|
||||
new ControlSlot(this, x + 18, y).assign(4);
|
||||
new ControlSlotArray(this, x, y + 18 + 18, 3, 1).create(Acclimatiser.SLOT_ACCLIMATISER);
|
||||
new ControlSlot.Builder(this, x + 18, y).assign(4);
|
||||
new ControlSlotArray.Builder(this, x, y + 18 + 18, 3, 1).create(Acclimatiser.SLOT_ACCLIMATISER);
|
||||
x += 72;
|
||||
new ControlSlotArray(this, x, y, 2, 2).create(Acclimatiser.SLOT_DRONE);
|
||||
new ControlSlotArray.Builder(this, x, y, 2, 2).create(Acclimatiser.SLOT_DRONE);
|
||||
new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
|
||||
new ControlErrorState(this, 181, 83);
|
||||
new ControlPlayerInventory(this);
|
||||
|
||||
@@ -38,9 +38,9 @@ public class WindowAnalyser extends WindowMachine {
|
||||
WindowAnalyser.Progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess.getTexture());
|
||||
int x = 16;
|
||||
final int y = 32;
|
||||
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_RESERVE);
|
||||
new ControlSlotArray.Builder(this, x, y, 2, 3).create(Analyser.SLOT_RESERVE);
|
||||
x += 28;
|
||||
new ControlSlot(this, x, y + 54 + 8).assign(13);
|
||||
new ControlSlot.Builder(this, x, y + 54 + 8).assign(13);
|
||||
new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColour(10040319);
|
||||
new ControlEnergyBar(this, x + 24 + 16, y + 54 + 8 + 1, 60, 16, Position.Left);
|
||||
new ControlErrorState(this, x + 24 + 16 + 60 + 16, y + 54 + 8 + 1);
|
||||
@@ -49,10 +49,10 @@ public class WindowAnalyser extends WindowMachine {
|
||||
x += 56;
|
||||
new Panel(this, x, y, 76, 50, MinecraftGUI.PanelType.Tinted);
|
||||
new ControlProgress(this, x + 5, y + 5, WindowAnalyser.ProgressBase, WindowAnalyser.Progress, Position.Left);
|
||||
new ControlSlot(this, x + 38 - 9, y + 25 - 9).assign(6);
|
||||
new ControlSlot.Builder(this, x + 38 - 9, y + 25 - 9).assign(6);
|
||||
new ControlIconDisplay(this, x + 76 + 2, y + 18, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 96;
|
||||
new ControlSlotArray(this, x, y, 2, 3).create(Analyser.SLOT_FINISHED);
|
||||
new ControlSlotArray.Builder(this, x, y, 2, 3).create(Analyser.SLOT_FINISHED);
|
||||
x += 52;
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@@ -36,17 +36,17 @@ public class WindowGenepool extends WindowMachine {
|
||||
final int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(1);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Genepool.SLOT_RESERVE);
|
||||
new ControlSlotArray.Builder(this, x, y + 3, 2, 3).create(Genepool.SLOT_RESERVE);
|
||||
x += 38;
|
||||
new ControlIconDisplay(this, x, y + 3 + 18 + 1, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 18;
|
||||
new ControlSlot(this, x, y + 3 + 18).assign(0);
|
||||
new ControlSlot.Builder(this, x, y + 3 + 18).assign(0);
|
||||
x += 18;
|
||||
new ControlMachineProgress(this, x, y + 19, WindowGenepool.ProgressBase, WindowGenepool.Progress, Position.Left);
|
||||
x += 130;
|
||||
new ControlLiquidTank(this, x, y).setTankID(0);
|
||||
new ControlEnergyBar(this, 21, 115, 16, 60, Position.Bottom);
|
||||
new ControlSlot(this, 121, 82).assign(7);
|
||||
new ControlSlot.Builder(this, 121, 82).assign(7);
|
||||
new ControlSlotCharge(this, 143, 82, 7).setColour(15722671);
|
||||
new ControlErrorState(this, 181, 83);
|
||||
new ControlPlayerInventory(this);
|
||||
|
||||
@@ -35,16 +35,16 @@ public class WindowIncubator extends WindowMachine {
|
||||
final int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(0);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_QUEUE);
|
||||
new ControlSlotArray.Builder(this, x, y + 3, 1, 3).create(Incubator.SLOT_QUEUE);
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 18;
|
||||
new ControlMachineProgress(this, x, y + 6, WindowIncubator.ProgressBase, WindowIncubator.Progress, Position.Left);
|
||||
new ControlSlot(this, x + 11, y + 3 + 10).assign(3);
|
||||
new ControlSlot.Builder(this, x + 11, y + 3 + 10).assign(3);
|
||||
x += 40;
|
||||
new ControlIconDisplay(this, x, y + 3 + 10, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 18;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Incubator.SLOT_OUTPUT);
|
||||
new ControlSlotArray.Builder(this, x, y + 3, 1, 3).create(Incubator.SLOT_OUTPUT);
|
||||
x += 26;
|
||||
new ControlLiquidTank(this, x, y).setTankID(1);
|
||||
x += 34;
|
||||
|
||||
@@ -37,11 +37,11 @@ public class WindowInoculator extends WindowMachine {
|
||||
final int y = 32;
|
||||
new ControlLiquidTank(this, x, y + 18 + 16).setTankID(0);
|
||||
CraftGUIUtil.horizontalGrid(x, y,
|
||||
new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_RESERVE),
|
||||
new ControlSlotArray.Builder(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(0),
|
||||
new ControlSlot.Builder(this, 0, 0).assign(0),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlotArray(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_EXPENDED)
|
||||
new ControlSlotArray.Builder(this, 0, 0, 2, 1).create(Inoculator.SLOT_SERUM_EXPENDED)
|
||||
);
|
||||
x += 18;
|
||||
new ControlMachineProgress(this, x, y + 24, WindowInoculator.ProgressBase, WindowInoculator.Progress, Position.Left);
|
||||
@@ -49,9 +49,9 @@ public class WindowInoculator extends WindowMachine {
|
||||
new ControlErrorState(this, 161, 118);
|
||||
x += 142;
|
||||
CraftGUIUtil.verticalGrid(x, y, TextJustification.MiddleLeft, 8,
|
||||
new ControlSlotArray(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE),
|
||||
new ControlSlot(this, x, y + 18 + 8).assign(9),
|
||||
new ControlSlotArray(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.SLOT_FINISHED)
|
||||
new ControlSlotArray.Builder(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE),
|
||||
new ControlSlot.Builder(this, x, y + 18 + 8).assign(9),
|
||||
new ControlSlotArray.Builder(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.SLOT_FINISHED)
|
||||
);
|
||||
new ControlIconDisplay(this, x + 18, y + 18 + 2, GUIIcon.ArrowUpLeft.getIcon().getResourceLocation());
|
||||
new ControlIconDisplay(this, x + 18, y + 18 + 18, GUIIcon.ArrowLeftDown.getIcon().getResourceLocation());
|
||||
|
||||
@@ -36,23 +36,23 @@ public class WindowIsolator extends WindowMachine {
|
||||
final int y = 32;
|
||||
new ControlLiquidTank(this, x, y).setTankID(0);
|
||||
x += 26;
|
||||
new ControlSlotArray(this, x, y + 3, 1, 3).create(Isolator.SLOT_RESERVE);
|
||||
new ControlSlotArray.Builder(this, x, y + 3, 1, 3).create(Isolator.SLOT_RESERVE);
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 18;
|
||||
new ControlSlot(this, x, y + 3).assign(5);
|
||||
new ControlSlot(this, x, y + 36 + 3).assign(0);
|
||||
new ControlSlot.Builder(this, x, y + 3).assign(5);
|
||||
new ControlSlot.Builder(this, x, y + 36 + 3).assign(0);
|
||||
new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColour(15722671);
|
||||
x += 18;
|
||||
new ControlProgress(this, x, y + 3, WindowIsolator.ProgressBase, WindowIsolator.Progress, Position.Left);
|
||||
x += 142;
|
||||
new ControlSlot(this, x, y + 3).assign(6);
|
||||
new ControlSlot(this, x, y + 3 + 36).assign(1);
|
||||
new ControlSlot.Builder(this, x, y + 3).assign(6);
|
||||
new ControlSlot.Builder(this, x, y + 3 + 36).assign(1);
|
||||
new ControlIconDisplay(this, x + 1, y + 3 + 19, GUIIcon.ArrowUp.getIcon().getResourceLocation());
|
||||
x += 20;
|
||||
new ControlIconDisplay(this, x, y + 3 + 1, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 18;
|
||||
new ControlSlotArray(this, x, y + 3, 2, 3).create(Isolator.SLOT_FINISHED);
|
||||
new ControlSlotArray.Builder(this, x, y + 3, 2, 3).create(Isolator.SLOT_FINISHED);
|
||||
new ControlEnergyBar(this, 260, 130, 16, 60, Position.Bottom);
|
||||
new ControlErrorState(this, 153, 81);
|
||||
new ControlPlayerInventory(this);
|
||||
|
||||
@@ -34,19 +34,19 @@ public class WindowPolymeriser extends WindowMachine {
|
||||
super.initialiseClient();
|
||||
int x = 16;
|
||||
final int y = 38;
|
||||
new ControlSlotArray(this, x, y, 1, 4).create(Polymeriser.SLOT_SERUM_RESERVE);
|
||||
new ControlSlotArray.Builder(this, x, y, 1, 4).create(Polymeriser.SLOT_SERUM_RESERVE);
|
||||
new ControlIconDisplay(this, x + 18, y + 1, GUIIcon.ArrowRight.getIcon().getResourceLocation());
|
||||
x += 34;
|
||||
new ControlMachineProgress(this, x + 18, y - 6, WindowPolymeriser.ProgressBase, WindowPolymeriser.Progress, Position.Left);
|
||||
new ControlSlot(this, x, y).assign(0);
|
||||
new ControlSlot.Builder(this, x, y).assign(0);
|
||||
new ControlLiquidTank(this, x, y + 18 + 16, true).setTankID(0);
|
||||
new ControlLiquidTank(this, x, y + 18 + 16 + 18 + 8, true).setTankID(1);
|
||||
new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.Left);
|
||||
x += 40;
|
||||
new ControlSlot(this, x + 30, y + 18 + 8).assign(1);
|
||||
new ControlSlot.Builder(this, x + 30, y + 18 + 8).assign(1);
|
||||
new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColour(16766976);
|
||||
x += 138;
|
||||
new ControlSlotArray(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED);
|
||||
new ControlSlotArray.Builder(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED);
|
||||
final ControlErrorState errorState = new ControlErrorState(this, 244, 97);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@@ -48,20 +48,18 @@ public class WindowSequencer extends WindowMachine {
|
||||
int x = 16;
|
||||
int y = 32;
|
||||
CraftGUIUtil.horizontalGrid(x, y, TextJustification.MiddleCenter, 2,
|
||||
new ControlSlotArray(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE),
|
||||
new ControlSlotArray.Builder(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSequencerProgress(this, 0, 0),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(6)
|
||||
new ControlSlot.Builder(this, 0, 0).assign(6)
|
||||
);
|
||||
final ControlSlot slotTarget = new ControlSlot(this, x + 96, y + 16);
|
||||
slotTarget.assign(5);
|
||||
final ControlSlot slotTarget = new ControlSlot.Builder(this, x + 96, y + 16).assign(5);
|
||||
x = 34;
|
||||
y = 92;
|
||||
this.slotText = new ControlText(this, new IArea(0, y, this.w(), 12), TextFormatting.DARK_GRAY + Genetics.proxy.localise("machine.machine.sequencer.texts.userless"), TextJustification.MiddleCenter);
|
||||
y += 20;
|
||||
final ControlSlot slotDye = new ControlSlot(this, x, y);
|
||||
slotDye.assign(0);
|
||||
final ControlSlot slotDye = new ControlSlot.Builder(this, x, y).assign(0);
|
||||
x += 20;
|
||||
new ControlSlotCharge(this, x, y, 0).setColour(16750848);
|
||||
x += 32;
|
||||
|
||||
@@ -35,21 +35,21 @@ public class WindowSplicer extends WindowMachine {
|
||||
int x = 16;
|
||||
new ControlSplicerProgress(this, 84, 32, this.w() - 172, 102);
|
||||
CraftGUIUtil.horizontalGrid(x, 62,
|
||||
new ControlSlotArray(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE),
|
||||
new ControlSlotArray.Builder(this, 0, 0, 2, 1).create(Splicer.SLOT_SERUM_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowRight.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(0)
|
||||
new ControlSlot.Builder(this, 0, 0).assign(0)
|
||||
);
|
||||
new ControlSlotArray(this, x + 12, 84, 2, 1).create(Splicer.SLOT_SERUM_EXPENDED);
|
||||
new ControlSlotArray.Builder(this, x + 12, 84, 2, 1).create(Splicer.SLOT_SERUM_EXPENDED);
|
||||
new ControlIconDisplay(this, x + 12 + 36 + 4, 86, GUIIcon.ArrowUpLeft.getIcon().getResourceLocation());
|
||||
new ControlEnergyBar(this, 196, 64, 60, 16, Position.Left);
|
||||
new ControlErrorState(this, 218, 86);
|
||||
x += 142;
|
||||
CraftGUIUtil.verticalGrid((this.w() - 72) / 2, 32, TextJustification.MiddleCenter, 4,
|
||||
new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE),
|
||||
new ControlSlotArray.Builder(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowDown.getIcon().getResourceLocation()),
|
||||
new ControlSlot(this, 0, 0).assign(9),
|
||||
new ControlSlot.Builder(this, 0, 0).assign(9),
|
||||
new ControlIconDisplay(this, 0, 0, GUIIcon.ArrowDown.getIcon().getResourceLocation()),
|
||||
new ControlSlotArray(this, 0, 0, 4, 1).create(Inoculator.SLOT_FINISHED)
|
||||
new ControlSlotArray.Builder(this, 0, 0, 4, 1).create(Inoculator.SLOT_FINISHED)
|
||||
);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ public class GenepoolLogic extends ComponentProcessSetCost implements IProcess {
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (!this.getUtil().spaceInTank(Genepool.TANK_DNA, getDNAAmount(this.getUtil().getStack(0)))) {
|
||||
ItemStack individual = this.getUtil().getStack(Genepool.SLOT_BEE);
|
||||
if (!this.getUtil().spaceInTank(Genepool.TANK_DNA, getDNAAmount(individual))) {
|
||||
return new ErrorState.NoSpace(Genetics.proxy.localise("machine.errors.tanks.no.room.desc"), new int[]{0});
|
||||
}
|
||||
if (!this.getUtil().liquidInTank(Genepool.TANK_ETHANOL, 1)) {
|
||||
@@ -77,6 +78,7 @@ public class GenepoolLogic extends ComponentProcessSetCost implements IProcess {
|
||||
this.getUtil().drainTank(Genepool.TANK_ETHANOL, 1);
|
||||
--this.ethanolDrain;
|
||||
}
|
||||
this.getMachine().getInterface(IChargedSlots.class).alterCharge(Genepool.SLOT_ENZYME, -ENZYME_PER_PROCESS * this.getProgressPerTick() / 100.0f);
|
||||
IChargedSlots chargedSlots = this.getMachine().getInterface(IChargedSlots.class);
|
||||
chargedSlots.alterCharge(Genepool.SLOT_ENZYME, -ENZYME_PER_PROCESS * this.getProgressPerTick() / 100.0f);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -28,7 +30,7 @@ public class Incubator {
|
||||
private static IncubatorRecipeLarvae LARVAE_RECIPE;
|
||||
|
||||
public static void addRecipes() {
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticsItems.GrowthMedium.get(1), Binnie.LIQUID.getFluidStack("water", 25), GeneticLiquid.GrowthMedium.get(25), 0.2f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticsItems.GrowthMedium.get(1), new FluidStack(FluidRegistry.WATER, 25), GeneticLiquid.GrowthMedium.get(25), 0.2f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(new ItemStack(Items.WHEAT), GeneticLiquid.GrowthMedium.get(25), GeneticLiquid.Bacteria.get(5), 0.2f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(GeneticsItems.GrowthMedium.get(1), GeneticLiquid.Bacteria.get(0), GeneticLiquid.Bacteria.get(5), 0.05f));
|
||||
Incubator.RECIPES.add(new IncubatorRecipe(new ItemStack(Items.SUGAR), GeneticLiquid.Bacteria.get(2), null, 0.5f, 0.2f)
|
||||
|
||||
@@ -10,10 +10,12 @@ import binnie.genetics.api.IIncubatorRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class IncubatorLogic extends ComponentProcessIndefinate implements IProcess {
|
||||
IIncubatorRecipe recipe;
|
||||
@Nullable
|
||||
private IIncubatorRecipe recipe;
|
||||
private Random rand;
|
||||
private boolean roomForOutput;
|
||||
|
||||
@@ -57,6 +59,7 @@ public class IncubatorLogic extends ComponentProcessIndefinate implements IProce
|
||||
return this.recipe != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IIncubatorRecipe getRecipe(final ItemStack stack, final FluidStack liquid) {
|
||||
for (final IIncubatorRecipe recipe : Incubator.getRecipes()) {
|
||||
final boolean rightLiquid = recipe.isInputLiquid(liquid);
|
||||
|
||||
@@ -6,21 +6,24 @@ import binnie.genetics.api.IIncubatorRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
private final FluidStack input;
|
||||
@Nullable
|
||||
private final FluidStack output;
|
||||
private final ItemStack itemStack;
|
||||
private final float lossChance;
|
||||
private final float tickChance;
|
||||
@Nullable
|
||||
private ItemStack outputStack;
|
||||
|
||||
public IncubatorRecipe(ItemStack itemStack, final FluidStack input, final FluidStack output, final float lossChance) {
|
||||
public IncubatorRecipe(ItemStack itemStack, final FluidStack input, @Nullable final FluidStack output, final float lossChance) {
|
||||
this(itemStack, input, output, lossChance, 1.0f);
|
||||
}
|
||||
|
||||
public IncubatorRecipe(ItemStack itemStack, final FluidStack input, final FluidStack output, final float lossChance, final float chance) {
|
||||
public IncubatorRecipe(ItemStack itemStack, final FluidStack input, @Nullable final FluidStack output, final float lossChance, final float chance) {
|
||||
this.itemStack = itemStack;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
@@ -39,12 +42,12 @@ public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInputLiquid(final FluidStack fluid) {
|
||||
public boolean isInputLiquid(@Nullable final FluidStack fluid) {
|
||||
return fluid != null && this.input.isFluidEqual(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInputLiquidSufficient(final FluidStack fluid) {
|
||||
public boolean isInputLiquidSufficient(@Nullable final FluidStack fluid) {
|
||||
return fluid != null && fluid.amount >= 500;
|
||||
}
|
||||
|
||||
@@ -54,6 +57,7 @@ public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FluidStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
@@ -91,6 +95,7 @@ public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected ItemStack getOutputStack(final MachineUtil util) {
|
||||
return getExpectedOutput();
|
||||
}
|
||||
@@ -98,7 +103,7 @@ public class IncubatorRecipe implements IIncubatorRecipe {
|
||||
@Override
|
||||
public boolean roomForOutput(final MachineUtil machine) {
|
||||
if (this.output != null && !machine.isTankEmpty(1)) {
|
||||
if (!machine.getFluid(Incubator.TANK_OUTPUT).isFluidEqual(this.output)) {
|
||||
if (!this.output.isFluidEqual(machine.getFluid(Incubator.TANK_OUTPUT))) {
|
||||
return false;
|
||||
}
|
||||
if (!machine.spaceInTank(Incubator.TANK_OUTPUT, this.output.amount)) {
|
||||
|
||||
@@ -23,11 +23,11 @@ public class InoculatorLogic extends ComponentProcess implements IProcess {
|
||||
public static final int PROCESS_BASE_ENERGY = 600000;
|
||||
public static final int BACTERIA_PER_PROCESS = 15;
|
||||
|
||||
public static int getProcessLength(ItemStack itemStack) {
|
||||
public static int getProcessLength(@Nullable ItemStack itemStack) {
|
||||
return PROCESS_BASE_LENGTH * getNumberOfGenes(itemStack);
|
||||
}
|
||||
|
||||
public static int getProcessBaseEnergy(ItemStack itemStack) {
|
||||
public static int getProcessBaseEnergy(@Nullable ItemStack itemStack) {
|
||||
return PROCESS_BASE_ENERGY * getNumberOfGenes(itemStack);
|
||||
}
|
||||
|
||||
@@ -80,12 +80,14 @@ public class InoculatorLogic extends ComponentProcess implements IProcess {
|
||||
if (state != null) {
|
||||
return state;
|
||||
}
|
||||
if (this.getUtil().getStack(Inoculator.SLOT_SERUM_VIAL) != null && Engineering.getCharges(this.getUtil().getStack(Inoculator.SLOT_SERUM_VIAL)) == 0) {
|
||||
ItemStack serum = this.getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
if (serum != null && Engineering.getCharges(serum) == 0) {
|
||||
return new ErrorState(Genetics.proxy.localise("machine.errors.empty.serum.desc"), Genetics.proxy.localise("machine.errors.empty.serum.info"));
|
||||
}
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ErrorState isValidSerum() {
|
||||
final ItemStack serum = this.getUtil().getStack(Inoculator.SLOT_SERUM_VIAL);
|
||||
final ItemStack target = this.getUtil().getStack(Inoculator.SLOT_TARGET);
|
||||
|
||||
Reference in new issue
Block a user