Search in sources :

Example 1 with DummyModuleContainer

use of logisticspipes.utils.gui.DummyModuleContainer in project LogisticsPipes by RS485.

the class AdvancedExtractorModuleInHand method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    DummyModuleContainer dummy = new DummyModuleContainer(player, getInvSlot());
    if (!(dummy.getModule() instanceof ModuleAdvancedExtractor)) {
        return null;
    }
    dummy.setInventory(((ModuleAdvancedExtractor) dummy.getModule()).getFilterInventory());
    dummy.addNormalSlotsForPlayerInventory(8, 60);
    //Pipe slots
    for (int pipeSlot = 0; pipeSlot < 9; pipeSlot++) {
        dummy.addDummySlot(pipeSlot, 8 + pipeSlot * 18, 18);
    }
    return dummy;
}
Also used : DummyModuleContainer(logisticspipes.utils.gui.DummyModuleContainer) ModuleAdvancedExtractor(logisticspipes.modules.ModuleAdvancedExtractor)

Example 2 with DummyModuleContainer

use of logisticspipes.utils.gui.DummyModuleContainer in project LogisticsPipes by RS485.

the class ApiaristSinkModuleInHand method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    SimpleServiceLocator.forestryProxy.syncTracker(player.getEntityWorld(), player);
    DummyModuleContainer dummy = new DummyModuleContainer(player, getInvSlot());
    if (!(dummy.getModule() instanceof ModuleApiaristSink)) {
        return null;
    }
    return dummy;
}
Also used : ModuleApiaristSink(logisticspipes.modules.ModuleApiaristSink) DummyModuleContainer(logisticspipes.utils.gui.DummyModuleContainer)

Example 3 with DummyModuleContainer

use of logisticspipes.utils.gui.DummyModuleContainer in project LogisticsPipes by RS485.

the class CraftingModuleInHand method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    DummyModuleContainer dummy = new DummyModuleContainer(player, getInvSlot());
    if (!(dummy.getModule() instanceof ModuleCrafter)) {
        return null;
    }
    MainProxy.sendPacketToPlayer(((ModuleCrafter) dummy.getModule()).getCPipePacket(), player);
    dummy.setInventory(((ModuleCrafter) dummy.getModule()).getDummyInventory());
    dummy.addNormalSlotsForPlayerInventory(18, 97);
    //Input slots
    for (int l = 0; l < 9; l++) {
        dummy.addFuzzyDummySlot(l, 18 + l * 18, 18, ((ModuleCrafter) dummy.getModule()).fuzzyCraftingFlagArray[l]);
    }
    //Output slot
    dummy.addFuzzyDummySlot(9, 90, 64, ((ModuleCrafter) dummy.getModule()).outputFuzzyFlags);
    return dummy;
}
Also used : DummyModuleContainer(logisticspipes.utils.gui.DummyModuleContainer) ModuleCrafter(logisticspipes.modules.ModuleCrafter)

Example 4 with DummyModuleContainer

use of logisticspipes.utils.gui.DummyModuleContainer 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 ModuleAdvancedExtractor) {
                player.closeScreen();
                NewGuiHandler.getGui(ExtractorModuleInHand.class).setInvSlot(getPositionInt()).open(player);
            }
        }
        return;
    }
    final LogisticsTileGenericPipe pipe = this.getPipe(player.worldObj);
    if (pipe == null) {
        return;
    }
    if (!(pipe.pipe instanceof CoreRoutedPipe)) {
        return;
    }
    final CoreRoutedPipe piperouted = (CoreRoutedPipe) pipe.pipe;
    if (piperouted.getLogisticsModule() == null) {
        return;
    }
    if (piperouted.getLogisticsModule().getSubModule(getPositionInt()) instanceof ModuleAdvancedExtractor) {
        final ModuleAdvancedExtractor module = (ModuleAdvancedExtractor) piperouted.getLogisticsModule().getSubModule(getPositionInt());
        NewGuiHandler.getGui(ExtractorModuleSlot.class).setSneakyOrientation(module.getSneakyDirection()).setSlot(getType()).setPositionInt(getPositionInt()).setPosX(getPosX()).setPosY(getPosY()).setPosZ(getPosZ()).open(player);
        return;
    }
}
Also used : DummyModuleContainer(logisticspipes.utils.gui.DummyModuleContainer) ModuleAdvancedExtractor(logisticspipes.modules.ModuleAdvancedExtractor) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) ExtractorModuleSlot(logisticspipes.network.guis.module.inpipe.ExtractorModuleSlot)

Example 5 with DummyModuleContainer

use of logisticspipes.utils.gui.DummyModuleContainer in project LogisticsPipes by RS485.

the class ModuleCoordinatesPacket method getLogisticsModule.

@SuppressWarnings("unchecked")
public <T> T getLogisticsModule(EntityPlayer player, Class<T> clazz) {
    LogisticsModule module = null;
    if (type == ModulePositionType.IN_PIPE) {
        moduleBased = true;
        LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld());
        moduleBased = false;
        if (pipe == null || !(pipe.pipe instanceof CoreRoutedPipe)) {
            targetNotFound("Couldn't find " + clazz.getName() + ", pipe didn't exsist");
            return null;
        }
        module = ((CoreRoutedPipe) pipe.pipe).getLogisticsModule();
    } else if (type == ModulePositionType.IN_HAND) {
        if (MainProxy.isServer(player.getEntityWorld())) {
            if (player.openContainer instanceof DummyModuleContainer) {
                DummyModuleContainer dummy = (DummyModuleContainer) player.openContainer;
                module = dummy.getModule();
            } else {
                targetNotFound("Couldn't find " + clazz.getName() + ", container wasn't a DummyModule Container");
                return null;
            }
        } else {
            module = MainProxy.proxy.getModuleFromGui();
            if (module == null) {
                targetNotFound("Couldn't find " + clazz.getName() + ", GUI didn't provide the module");
                return null;
            }
        }
    } else {
        moduleBased = true;
        LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld());
        moduleBased = false;
        if (pipe == null || !(pipe.pipe instanceof CoreRoutedPipe)) {
            targetNotFound("Couldn't find " + clazz.getName() + ", pipe didn't exsist");
            return null;
        } else if (!pipe.isInitialized()) {
            return null;
        }
        if (!(pipe.pipe instanceof PipeLogisticsChassi)) {
            targetNotFound("Couldn't find " + clazz.getName() + ", pipe wasn't a chassi pipe");
            return null;
        }
        module = ((PipeLogisticsChassi) pipe.pipe).getLogisticsModule().getSubModule(positionInt);
    }
    if (module != null) {
        if (!(clazz.isAssignableFrom(module.getClass()))) {
            targetNotFound("Couldn't find " + clazz.getName() + ", found " + module.getClass());
            return null;
        }
    } else {
        targetNotFound("Couldn't find " + clazz.getName());
    }
    return (T) module;
}
Also used : DummyModuleContainer(logisticspipes.utils.gui.DummyModuleContainer) PipeLogisticsChassi(logisticspipes.pipes.PipeLogisticsChassi) LogisticsModule(logisticspipes.modules.abstractmodules.LogisticsModule) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe)

Aggregations

DummyModuleContainer (logisticspipes.utils.gui.DummyModuleContainer)13 ItemIdentifierInventory (logisticspipes.utils.item.ItemIdentifierInventory)3 ModuleAdvancedExtractor (logisticspipes.modules.ModuleAdvancedExtractor)2 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)2 LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)2 DummyContainer (logisticspipes.utils.gui.DummyContainer)2 IStringBasedModule (logisticspipes.interfaces.IStringBasedModule)1 ModuleActiveSupplier (logisticspipes.modules.ModuleActiveSupplier)1 ModuleApiaristSink (logisticspipes.modules.ModuleApiaristSink)1 ModuleCrafter (logisticspipes.modules.ModuleCrafter)1 ModuleElectricManager (logisticspipes.modules.ModuleElectricManager)1 ModuleItemSink (logisticspipes.modules.ModuleItemSink)1 ModuleOreDictItemSink (logisticspipes.modules.ModuleOreDictItemSink)1 ModuleProvider (logisticspipes.modules.ModuleProvider)1 ModuleThaumicAspectSink (logisticspipes.modules.ModuleThaumicAspectSink)1 LogisticsModule (logisticspipes.modules.abstractmodules.LogisticsModule)1 LogisticsSimpleFilterModule (logisticspipes.modules.abstractmodules.LogisticsSimpleFilterModule)1 ExtractorModuleSlot (logisticspipes.network.guis.module.inpipe.ExtractorModuleSlot)1 PipeLogisticsChassi (logisticspipes.pipes.PipeLogisticsChassi)1