@Override public final TankSlot addTank(final int index, final String name, final int capacity) { TankSlot tank = new TankSlot(index, name, capacity); this.tanks.put(index, tank); return tank; }
private static int getTankIndexToDrain(Map<Integer, TankSlot> tanks, @Nullable EnumFacing from, @Nullable final FluidStack resource) { for (final TankSlot tank : tanks.values()) { if (tank.getContent() != null && tank.canExtract(from) && (resource == null || resource.isFluidEqual(tank.getContent()))) { return tank.getIndex(); } } return -1; } }
private static int getTankIndexToFill(Map<Integer, TankSlot> tanks, @Nullable EnumFacing from, final FluidStack resource) { for (final TankSlot tank : tanks.values()) { if (tank.isValid(resource) && tank.canInsert(from) && (tank.getContent() == null || tank.getContent().isFluidEqual(resource))) { return tank.getIndex(); } } return -1; }
@Override public void createMachine(final Machine machine) { new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.DISTILLERY); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); final ComponentTankContainer tanks = new ComponentTankContainer(machine); final TankSlot input = tanks.addTank(TANK_INPUT, "input", 5000); input.setValidator(new TankValidatorDistilleryInput()); input.forbidExtraction(); final TankSlot output = tanks.addTank(TANK_OUTPUT, "output", 5000); output.setValidator(new TankValidatorDistilleryOutput()); output.setReadOnly(); new ComponentPowerReceptor(machine); new DistilleryLogic(machine); }
@Override @SideOnly(Side.CLIENT) public void getHelpTooltip(final Tooltip tooltip, ITooltipFlag tooltipFlag) { if (this.getTankSlot() != null) { final TankSlot slot = this.getTankSlot(); tooltip.add(slot.getName()); NumberFormat numberFormat = I18N.getNumberFormat(); tooltip.add(I18N.localise(ModId.CORE, "gui.tank.capacity", numberFormat.format(this.getTankCapacity()))); if (tooltipFlag.isAdvanced()) { Collection<EnumFacing> inputSides = slot.getInputSides(); if (inputSides.size() > 0) { tooltip.add(TextFormatting.GRAY + I18N.localise(ModId.CORE, "gui.side.insert", MachineSide.asString(inputSides))); } Collection<EnumFacing> outputSides = slot.getOutputSides(); if (outputSides.size() > 0) { tooltip.add(TextFormatting.GRAY + I18N.localise(ModId.CORE, "gui.side.extract", MachineSide.asString(outputSides))); } if (slot.isReadOnly()) { tooltip.add(TextFormatting.GRAY + I18N.localise(ModId.CORE, "gui.tank.output")); } } } }
@Override public void createMachine(final Machine machine) { new ComponentGeneticGUI(machine, GeneticsGUI.INCUBATOR); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); for (InventorySlot slot : inventory.addSlotArray(Incubator.SLOT_QUEUE, getSlotRL("input"))) { slot.forbidExtraction(); } InventorySlot slotIncubator = inventory.addSlot(Incubator.SLOT_INCUBATOR, getSlotRL("incubator")); slotIncubator.forbidInteraction(); for (InventorySlot slot : inventory.addSlotArray(Incubator.SLOT_OUTPUT, getSlotRL("output"))) { slot.setReadOnly(); } new ComponentPowerReceptor(machine, 2000); ComponentTankContainer tanks = new ComponentTankContainer(machine); tanks.addTank(Incubator.TANK_INPUT, "input", 2000).forbidExtraction(); tanks.addTank(Incubator.TANK_OUTPUT, "output", 2000).setReadOnly(); new IncubatorLogic(machine); }
@Override public void createMachine(final Machine machine) { new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.LUMBERMILL); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotLog = inventory.addSlot(SLOT_LOG, getSlotRL("input")); slotLog.setValidator(new SlotValidatorLog(machine.getWorld())); slotLog.forbidExtraction(); inventory.addSlot(SLOT_PLANKS, getSlotRL("output")).setReadOnly(); inventory.addSlot(SLOT_BARK, getSlotRL("byproduct")).setReadOnly(); inventory.addSlot(SLOT_SAWDUST, getSlotRL("byproduct")).setReadOnly(); final ComponentTankContainer tanks = new ComponentTankContainer(machine); TankSlot tankWater = tanks.addTank(TANK_WATER, "input", TANK_WATER_CAPACITY); tankWater.setValidator(new TankValidator.Basic(ManagerLiquid.WATER)); new ComponentPowerReceptor(machine); new LumbermillLogic(machine); }
@Override public void createMachine(final Machine machine) { new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.PRESS); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); final InventorySlot input = inventory.addSlot(SLOT_FRUIT, getSlotRL("input")); input.setValidator(new SlotValidatorSqueezable()); input.forbidExtraction(); final InventorySlot process = inventory.addSlot(SLOT_CURRENT, getSlotRL("process")); process.setValidator(new SlotValidatorSqueezable()); process.forbidInteraction(); final ComponentTankContainer tanks = new ComponentTankContainer(machine); tanks.addTank(TANK_OUTPUT, "output", TANK_OUTPUT_CAPACITY).setReadOnly(); new ComponentPowerReceptor(machine); new ComponentInventoryTransfer(machine).addRestock(new int[]{SLOT_FRUIT}, SLOT_CURRENT, 1); new FruitPressLogic(machine); }
@Override public NBTTagCompound writeToNBT(final NBTTagCompound compound) { if (this.getContent() != null) { this.getContent().writeToNBT(compound); } return compound; }
@Override public void createMachine(final Machine machine) { new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.INFUSER); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); final ComponentTankContainer tanks = new ComponentTankContainer(machine); final TankSlot input = tanks.addTank(Infuser.TANK_INPUT, "input", 5000); input.setValidator(new TankValidatorInfuserInput()); input.forbidExtraction(); final TankSlot output = tanks.addTank(Infuser.TANK_OUTPUT, "output", 5000); output.setValidator(new TankValidatorInfuserOutput()); output.setReadOnly(); new ComponentPowerReceptor(machine); new InfuserLogic(machine); }
transfer.addStorage(Polymeriser.SLOT_SERUM, Polymeriser.SLOT_SERUM_FINISHED, (stack) -> !stack.isItemDamaged()); ComponentTankContainer tank = new ComponentTankContainer(machine); tank.addTank(Polymeriser.TANK_BACTERIA, "input", 1000).setValidator(new BacteriaTankValidator()); tank.addTank(Polymeriser.TANK_DNA, "input", 1000).setValidator(new DnaTankValidator()); new ComponentChargedSlots(machine).addCharge(1); new ComponentPowerReceptor(machine, 8000);
@Override public void createMachine(final Machine machine) { new ExtraTreeMachine.ComponentExtraTreeGUI(machine, ExtraTreesGUID.BREWERY); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); for (final InventorySlot slot : inventory.addSlotArray(SLOT_RECIPE_GRAINS, new ResourceLocation(Constants.CORE_MOD_ID, "gui.slot.grain"))) { slot.setValidator(new SlotValidatorBreweryGrain()); slot.setType(InventorySlot.Type.Recipe); } for (final InventorySlot slot : inventory.addSlotArray(SLOTS_INVENTORY, new ResourceLocation(Constants.CORE_MOD_ID, "gui.slot.inventory"))) { slot.forbidExtraction(); } final InventorySlot yeast = inventory.addSlot(SLOT_YEAST, getSlotRL("yeast")); yeast.setValidator(new SlotValidatorBreweryYeast()); yeast.setType(InventorySlot.Type.Recipe); final InventorySlot ingredient = inventory.addSlot(SLOT_RECIPE_INPUT, getSlotRL("ingredient")); ingredient.setValidator(new SlotValidatorBreweryIngredient()); ingredient.setType(InventorySlot.Type.Recipe); final ComponentTankContainer tanks = new ComponentTankContainer(machine); TankSlot input = tanks.addTank(TANK_INPUT, "input", 5000); input.setValidator(new TankValidatorFermentInput()); input.forbidExtraction(); final TankSlot output = tanks.addTank(TANK_OUTPUT, "output", 5000); output.setValidator(new TankValidatorFermentOutput()); output.setReadOnly(); new ComponentPowerReceptor(machine); new BreweryLogic(machine); }
tanks.addTank(Isolator.TANK_ETHANOL, "input", 1000).setValidator(new EthanolTankValidator());
@Override public final TankSlot addTank(final int index, final ResourceLocation name, final int capacity) { TankSlot tank = new TankSlot(index, name, capacity); this.tanks.put(index, tank); return tank; }
@Override public void createMachine(final Machine machine) { new ComponentGeneticGUI(machine, GeneticsGUI.GENEPOOL); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotEnzyme = inventory.addSlot(Genepool.SLOT_ENZYME, getSlotRL("enzyme")); slotEnzyme.setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.getSpriteEnzyme())); slotEnzyme.forbidExtraction(); InventorySlot slotProcess = inventory.addSlot(Genepool.SLOT_BEE, getSlotRL("process")); slotProcess.setValidator(new SlotValidator.Individual()); slotProcess.setReadOnly(); slotProcess.forbidExtraction(); for (InventorySlot slot : inventory.addSlotArray(Genepool.SLOT_RESERVE, getSlotRL("input"))) { slot.setValidator(new SlotValidator.Individual()); slot.forbidExtraction(); } ComponentTankContainer tanks = new ComponentTankContainer(machine); TankSlot tankDNA = tanks.addTank(Genepool.TANK_DNA, "output", 2000); tankDNA.setReadOnly(); TankSlot tankEthanol = tanks.addTank(Genepool.TANK_ETHANOL, "input", 1000); tankEthanol.forbidExtraction(); tankEthanol.setValidator(new EthanolTankValidator()); ComponentInventoryTransfer transfer = new ComponentInventoryTransfer(machine); transfer.addRestock(Genepool.SLOT_RESERVE, Genepool.SLOT_BEE, 1); new ComponentPowerReceptor(machine, 1600); new GenepoolLogic(machine); ComponentChargedSlots chargedSlots = new ComponentChargedSlots(machine); chargedSlots.addCharge(Genepool.SLOT_ENZYME); new GenepoolFX(machine); }
new InoculatorLogic(machine); new InoculatorFX(machine); new ComponentTankContainer(machine).addTank(Inoculator.TANK_VEKTOR, "input", 1000).setValidator(new BacteriaVectorTankValidator());