use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class GuiChassisPipe method updateModuleConfigButtonVisibility.
private void updateModuleConfigButtonVisibility(int slot) {
ItemStack module = _moduleInventory.getStackInSlot(slot);
LogisticsModule subModule = _chassiPipe.getSubModule(slot);
if (module.isEmpty() || subModule == null) {
moduleConfigButtons.get(slot).visible = false;
} else {
moduleConfigButtons.get(slot).visible = subModule instanceof Gui;
}
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class StringBasedItemSinkModuleGuiSlot method getClientGui.
@Override
public Object getClientGui(EntityPlayer player) {
LogisticsModule module = this.getLogisticsModule(player.getEntityWorld(), LogisticsModule.class);
if (!(module instanceof IStringBasedModule)) {
return null;
}
module.readFromNBT(getNbt());
return new GuiStringBasedItemSink(player.inventory, module);
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class PipeLogisticsChassis method canProvide.
/**
* IProvideItems **
*/
@Override
public void canProvide(RequestTreeNode tree, RequestTree root, List<IFilter> filters) {
if (!isEnabled()) {
return;
}
for (IFilter filter : filters) {
if (filter.isBlocked() == filter.isFilteredItem(tree.getRequestType()) || filter.blockProvider()) {
return;
}
}
for (int i = 0; i < getChassisSize(); i++) {
LogisticsModule x = getSubModule(i);
if (x instanceof ILegacyActiveModule) {
ILegacyActiveModule y = (ILegacyActiveModule) x;
y.canProvide(tree, root, filters);
}
}
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class PipeLogisticsChassis method itemArrived.
@Override
public void itemArrived(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).itemArrived(item, info);
}
} else {
if (LogisticsPipes.isDEBUG() && info != null) {
System.out.println(item);
new RuntimeException("[ItemArrived] Information weren't ment for a chassi pipe").printStackTrace();
}
}
}
}
use of logisticspipes.modules.LogisticsModule in project LogisticsPipes by RS485.
the class PipeLogisticsChassis method InventoryChanged.
@Override
public void InventoryChanged(IInventory inventory) {
boolean reInitGui = false;
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack stack = inventory.getStackInSlot(i);
if (stack.isEmpty()) {
if (_module.hasModule(i)) {
_module.removeModule(i);
reInitGui = true;
}
continue;
}
if (stack.getItem() instanceof ItemModule) {
LogisticsModule current = _module.getModule(i);
LogisticsModule next = ((ItemModule) stack.getItem()).getModuleForItem(stack, _module.getModule(i), this, this);
Objects.requireNonNull(next, "getModuleForItem returned null for " + stack.toString());
next.registerPosition(ModulePositionType.SLOT, i);
next.registerCCEventQueuer(this);
if (current != next) {
_module.installModule(i, next);
if (!MainProxy.isClient(getWorld())) {
ItemModuleInformationManager.readInformation(stack, next);
}
}
inventory.setInventorySlotContents(i, stack);
}
}
if (reInitGui) {
if (MainProxy.isClient(getWorld())) {
if (FMLClientHandler.instance().getClient().currentScreen instanceof GuiChassisPipe) {
FMLClientHandler.instance().getClient().currentScreen.initGui();
}
}
}
if (MainProxy.isServer(getWorld())) {
if (!localModeWatchers.isEmpty()) {
MainProxy.sendToPlayerList(PacketHandler.getPacket(ChassisPipeModuleContent.class).setIdentList(ItemIdentifierStack.getListFromInventory(_moduleInventory)).setPosX(getX()).setPosY(getY()).setPosZ(getZ()), localModeWatchers);
}
}
}
Aggregations