use of logisticspipes.utils.SinkReply in project LogisticsPipes by RS485.
the class ModuleApiaristAnalyser method registerPosition.
@Override
public void registerPosition(ModulePositionType slot, int positionInt) {
super.registerPosition(slot, positionInt);
_sinkReply = new SinkReply(FixedPriority.APIARIST_Analyser, 0, true, false, 3, 0, new ChassiTargetInformation(getPositionInt()));
}
use of logisticspipes.utils.SinkReply in project LogisticsPipes by RS485.
the class ModuleApiaristRefiller method tick.
@Override
public void tick() {
if (++currentTickCount < ticksToOperation) {
return;
}
currentTickCount = 0;
IInventory inv = _service.getRealInventory();
if (!(inv instanceof ISidedInventory)) {
return;
}
ISidedInventory sinv = (ISidedInventory) inv;
ForgeDirection direction = _service.inventoryOrientation().getOpposite();
ItemStack stack = extractItem(sinv, false, direction, 1);
if (stack == null) {
return;
}
if (!(_service.canUseEnergy(100))) {
return;
}
currentTickCount = ticksToOperation;
if (reinsertBee(stack, sinv, direction)) {
return;
}
Pair<Integer, SinkReply> reply = _service.hasDestination(ItemIdentifier.get(stack), true, new ArrayList<>());
if (reply == null) {
return;
}
_service.useEnergy(20);
extractItem(sinv, true, direction, 1);
_service.sendStack(stack, reply, ItemSendMode.Normal);
}
use of logisticspipes.utils.SinkReply in project LogisticsPipes by RS485.
the class ModuleApiaristSink method registerPosition.
@Override
public void registerPosition(ModulePositionType slot, int positionInt) {
super.registerPosition(slot, positionInt);
_sinkReply = new SinkReply(FixedPriority.APIARIST_BeeSink, 0, true, false, 2, 0, new ChassiTargetInformation(getPositionInt()));
}
use of logisticspipes.utils.SinkReply in project LogisticsPipes by RS485.
the class ModuleElectricBuffer method registerPosition.
@Override
public void registerPosition(ModulePositionType slot, int positionInt) {
super.registerPosition(slot, positionInt);
_sinkReply = new SinkReply(FixedPriority.ElectricBuffer, 0, true, false, 1, 0, new ChassiTargetInformation(getPositionInt()));
}
use of logisticspipes.utils.SinkReply in project LogisticsPipes by RS485.
the class ModuleElectricManager method tick.
@Override
public void tick() {
if (++currentTick < ticksToAction) {
return;
}
currentTick = 0;
IInventoryUtil inv = _service.getSneakyInventory(true, slot, positionInt);
if (inv == null) {
return;
}
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack == null) {
return;
}
if (isOfInterest(stack)) {
//If item set to discharge and its fully discharged, then extract it.
if (_dischargeMode && SimpleServiceLocator.IC2Proxy.isFullyDischarged(stack)) {
Triplet<Integer, SinkReply, List<IFilter>> reply = SimpleServiceLocator.logisticsManager.hasDestinationWithMinPriority(ItemIdentifier.get(stack), _service.getSourceID(), true, FixedPriority.ElectricBuffer);
if (reply == null) {
continue;
}
if (_service.useEnergy(10)) {
_service.spawnParticle(Particles.OrangeParticle, 2);
_service.sendStack(inv.decrStackSize(i, 1), reply, ItemSendMode.Normal);
return;
}
}
//If item set to charge and its fully charged, then extract it.
if (!_dischargeMode && SimpleServiceLocator.IC2Proxy.isFullyCharged(stack)) {
Triplet<Integer, SinkReply, List<IFilter>> reply = SimpleServiceLocator.logisticsManager.hasDestinationWithMinPriority(ItemIdentifier.get(stack), _service.getSourceID(), true, FixedPriority.ElectricBuffer);
if (reply == null) {
continue;
}
if (_service.useEnergy(10)) {
_service.spawnParticle(Particles.OrangeParticle, 2);
_service.sendStack(inv.decrStackSize(i, 1), reply, ItemSendMode.Normal);
return;
}
}
}
}
}
Aggregations