use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class PipeLogisticsChassis method getAllItems.
@Override
public void getAllItems(Map<ItemIdentifier, Integer> list, List<IFilter> filter) {
if (!isEnabled()) {
return;
}
for (int i = 0; i < getChassisSize(); i++) {
LogisticsModule x = getSubModule(i);
if (x instanceof ILegacyActiveModule) {
ILegacyActiveModule y = (ILegacyActiveModule) x;
y.getAllItems(list, filter);
}
}
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class PipeLogisticsChassis method itemLost.
@Override
public void itemLost(ItemIdentifierStack item, IAdditionalTargetInformation info) {
if (MainProxy.isServer(getWorld())) {
if (info instanceof ChassiTargetInformation) {
ChassiTargetInformation target = (ChassiTargetInformation) info;
LogisticsModule module = getSubModule(target.moduleSlot);
if (module instanceof IRequireReliableTransport) {
((IRequireReliableTransport) module).itemLost(item, info);
}
} else {
if (LogisticsPipes.isDEBUG()) {
System.out.println(item);
new RuntimeException("[ItemLost] Information weren't ment for a chassi pipe").printStackTrace();
}
}
}
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class PipeLogisticsChassis method fullFill.
@Override
public LogisticsOrder fullFill(LogisticsPromise promise, IRequestItems destination, IAdditionalTargetInformation info) {
if (!isEnabled()) {
return null;
}
for (int i = 0; i < getChassisSize(); i++) {
LogisticsModule x = getSubModule(i);
if (x instanceof ILegacyActiveModule) {
ILegacyActiveModule y = (ILegacyActiveModule) x;
LogisticsOrder result = y.fullFill(promise, destination, info);
if (result != null) {
spawnParticle(Particles.WhiteParticle, 2);
return result;
}
}
}
return null;
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class AdvancedExtractorSneakyGuiPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
if (getType() == ModulePositionType.IN_HAND) {
if (player.openContainer instanceof DummyModuleContainer) {
DummyModuleContainer dummy = (DummyModuleContainer) player.openContainer;
if (dummy.getModule() instanceof AsyncAdvancedExtractor) {
player.closeScreen();
NewGuiHandler.getGui(SneakyModuleInHandGuiProvider.class).setInvSlot(getPositionInt()).open(player);
}
}
return;
}
PipeLogisticsChassis pipe = getTileOrPipe(player.world, PipeLogisticsChassis.class);
LogisticsModule subModule = pipe.getSubModule(getPositionInt());
if (subModule instanceof AsyncAdvancedExtractor) {
NewGuiHandler.getGui(SneakyModuleInSlotGuiProvider.class).setSneakyOrientation(((AsyncAdvancedExtractor) subModule).getSneakyDirection()).setSlot(getType()).setPositionInt(getPositionInt()).setPosX(getPosX()).setPosY(getPosY()).setPosZ(getPosZ()).open(player);
}
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class ModulePropertiesUpdate method processPacket.
@Override
public void processPacket(EntityPlayer player) {
final LogisticsModule module = this.getLogisticsModule(player, LogisticsModule.class);
if (module == null) {
return;
}
// sync updated properties
module.readFromNBT(tag);
if (!getType().isInWorld() && player.openContainer instanceof ContainerPlayer) {
// FIXME: saveInformation & markDirty on module property change? should be called only once
// sync slot in player inventory and mark player inventory dirty
ItemModuleInformationManager.saveInformation(player.inventory.mainInventory.get(getPositionInt()), module);
player.inventory.markDirty();
}
MainProxy.runOnServer(player.world, () -> () -> {
// resync client; always
MainProxy.sendPacketToPlayer(fromPropertyHolder(module).setModulePos(module), player);
});
}
Aggregations