Files
Binnie/src/main/java/binnie/genetics/machine/splicer/SplicerPackage.java
T
ah-OOG-ah f0f14bb278 Minor cleanups (#50)
* Finalize, minor alloc reduction

Also enable Jabel and generic injection

* Update dependencies.gradle

* Clean up Machine a bit

* spotless

more enhanced instanceof

* Update ModuleMachine.java

* More clen

* WARN: Removed exception catching

* Many, many tiny patches + birthday fix

* Spotless

* Spotless again

* Fix getLow and clamp tolerance value

* Revert event -> ignored on unused event parameters

* Rename instanceof variables

* Update Machine.java

* Use StringBuilder

* Cache getStack()

* Oops, Jabel can't handle that

* Spotless

* Spotless again

My IDE was fighting with it

* Remove unused elements + scream test success
2024-09-26 16:59:20 +02:00

92 lines
3.8 KiB
Java

package binnie.genetics.machine.splicer;
import net.minecraft.item.ItemStack;
import binnie.core.craftgui.minecraft.IMachineInformation;
import binnie.core.machines.Machine;
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.genetics.core.GeneticsGUI;
import binnie.genetics.core.GeneticsTexture;
import binnie.genetics.genetics.Engineering;
import binnie.genetics.machine.AdvGeneticMachine;
import binnie.genetics.machine.ComponentGeneticGUI;
public class SplicerPackage extends AdvGeneticMachine.PackageAdvGeneticBase implements IMachineInformation {
public SplicerPackage() {
super("splicer", GeneticsTexture.Splicer, 0xe22235, true);
}
@Override
public void createMachine(Machine machine) {
new ComponentGeneticGUI(machine, GeneticsGUI.Splicer);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
SlotValidator serumValid = new SerumSlotValidator();
InventorySlot serumSlot = inventory.addSlot(Splicer.SLOT_SERUM_VIAL, "serum.active");
serumSlot.forbidInteraction();
serumSlot.setReadOnly();
serumSlot.setValidator(serumValid);
inventory.addSlotArray(Splicer.SLOT_SERUM_RESERVE, "serum.input");
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_SERUM_RESERVE)) {
slot.setValidator(serumValid);
slot.forbidExtraction();
}
inventory.addSlotArray(Splicer.SLOT_SERUM_EXPENDED, "serum.output");
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_SERUM_EXPENDED)) {
slot.setValidator(serumValid);
slot.setReadOnly();
}
inventory.addSlotArray(Splicer.SLOT_RESERVE, "input");
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_RESERVE)) {
slot.forbidExtraction();
slot.setValidator(new IndividualInoculateValidator());
}
InventorySlot targetSlot = inventory.addSlot(Splicer.SLOT_TARGET, "process");
targetSlot.setValidator(new IndividualInoculateValidator());
targetSlot.setReadOnly();
targetSlot.forbidInteraction();
inventory.addSlotArray(Splicer.SLOT_FINISHED, "output");
for (InventorySlot slot : inventory.getSlots(Splicer.SLOT_FINISHED)) {
slot.setReadOnly();
slot.forbidInsertion();
slot.setValidator(new IndividualInoculateValidator());
}
ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine);
transfer.addRestock(Splicer.SLOT_RESERVE, Splicer.SLOT_TARGET, 1);
transfer.addRestock(Splicer.SLOT_SERUM_RESERVE, Splicer.SLOT_SERUM_VIAL);
transfer.addStorage(
Splicer.SLOT_SERUM_VIAL,
Splicer.SLOT_SERUM_EXPENDED,
new ComponentInventoryTransfer.Condition() {
@Override
public boolean fufilled(ItemStack stack) {
return Engineering.getCharges(stack) == 0;
}
});
transfer.addStorage(Splicer.SLOT_TARGET, Splicer.SLOT_FINISHED, new ComponentInventoryTransfer.Condition() {
@Override
public boolean fufilled(ItemStack stack) {
return stack != null && transfer.getMachine().getMachineUtil().getStack(Splicer.SLOT_SERUM_VIAL) != null
&& transfer.getMachine().getInterface(SplicerComponentLogic.class).isValidSerum() != null;
}
});
new ComponentPowerReceptor(machine, Splicer.POWER_CAPACITY);
new SplicerComponentLogic(machine);
new SplicerComponentFX(machine);
}
}