Search in sources :

Example 1 with ItemModule

use of logisticspipes.items.ItemModule in project LogisticsPipes by RS485.

the class LogisticsPipes method initItems.

private void initItems(Side side) {
    boolean isClient = side == Side.CLIENT;
    Object renderer = null;
    if (isClient) {
        renderer = new FluidContainerRenderer();
    }
    LogisticsPipes.LogisticsItemCard = new LogisticsItemCard();
    LogisticsPipes.LogisticsItemCard.setUnlocalizedName("logisticsItemCard");
    GameRegistry.registerItem(LogisticsPipes.LogisticsItemCard, LogisticsPipes.LogisticsItemCard.getUnlocalizedName());
    if (isClient) {
        MinecraftForgeClient.registerItemRenderer(LogisticsPipes.LogisticsItemCard, (FluidContainerRenderer) renderer);
    }
    LogisticsPipes.LogisticsRemoteOrderer = new RemoteOrderer();
    LogisticsPipes.LogisticsRemoteOrderer.setUnlocalizedName("remoteOrdererItem");
    GameRegistry.registerItem(LogisticsPipes.LogisticsRemoteOrderer, LogisticsPipes.LogisticsRemoteOrderer.getUnlocalizedName());
    ItemPipeSignCreator.registerPipeSignTypes();
    LogisticsPipes.LogisticsCraftingSignCreator = new ItemPipeSignCreator();
    LogisticsPipes.LogisticsCraftingSignCreator.setUnlocalizedName("ItemPipeSignCreator");
    GameRegistry.registerItem(LogisticsPipes.LogisticsCraftingSignCreator, LogisticsPipes.LogisticsCraftingSignCreator.getUnlocalizedName());
    int renderIndex;
    if (isClient) {
        renderIndex = RenderingRegistry.addNewArmourRendererPrefix("LogisticsHUD");
    } else {
        renderIndex = 0;
    }
    LogisticsPipes.LogisticsHUDArmor = new ItemHUDArmor(renderIndex);
    LogisticsPipes.LogisticsHUDArmor.setUnlocalizedName("logisticsHUDGlasses");
    GameRegistry.registerItem(LogisticsPipes.LogisticsHUDArmor, LogisticsPipes.LogisticsHUDArmor.getUnlocalizedName());
    LogisticsPipes.LogisticsParts = new ItemParts();
    LogisticsPipes.LogisticsParts.setUnlocalizedName("logisticsParts");
    GameRegistry.registerItem(LogisticsPipes.LogisticsParts, LogisticsPipes.LogisticsParts.getUnlocalizedName());
    SimpleServiceLocator.buildCraftProxy.registerTrigger();
    LogisticsPipes.ModuleItem = new ItemModule();
    LogisticsPipes.ModuleItem.setUnlocalizedName("itemModule");
    LogisticsPipes.ModuleItem.loadModules();
    GameRegistry.registerItem(LogisticsPipes.ModuleItem, LogisticsPipes.ModuleItem.getUnlocalizedName());
    LogisticsPipes.LogisticsItemDisk = new ItemDisk();
    LogisticsPipes.LogisticsItemDisk.setUnlocalizedName("itemDisk");
    GameRegistry.registerItem(LogisticsPipes.LogisticsItemDisk, LogisticsPipes.LogisticsItemDisk.getUnlocalizedName());
    LogisticsPipes.UpgradeItem = new ItemUpgrade();
    LogisticsPipes.UpgradeItem.setUnlocalizedName("itemUpgrade");
    LogisticsPipes.UpgradeItem.loadUpgrades();
    GameRegistry.registerItem(LogisticsPipes.UpgradeItem, LogisticsPipes.UpgradeItem.getUnlocalizedName());
    LogisticsPipes.LogisticsFluidContainer = new LogisticsFluidContainer();
    LogisticsPipes.LogisticsFluidContainer.setUnlocalizedName("logisticsFluidContainer");
    if (isClient) {
        MinecraftForgeClient.registerItemRenderer(LogisticsPipes.LogisticsFluidContainer, (FluidContainerRenderer) renderer);
    }
    GameRegistry.registerItem(LogisticsPipes.LogisticsFluidContainer, LogisticsPipes.LogisticsFluidContainer.getUnlocalizedName());
    LogisticsPipes.LogisticsBrokenItem = new LogisticsBrokenItem();
    LogisticsPipes.LogisticsBrokenItem.setUnlocalizedName("brokenItem");
    GameRegistry.registerItem(LogisticsPipes.LogisticsBrokenItem, LogisticsPipes.LogisticsBrokenItem.getUnlocalizedName());
    LogisticsPipes.LogisticsPipeControllerItem = new ItemPipeController();
    LogisticsPipes.LogisticsPipeControllerItem.setUnlocalizedName("pipeController");
    GameRegistry.registerItem(LogisticsPipes.LogisticsPipeControllerItem, LogisticsPipes.LogisticsPipeControllerItem.getUnlocalizedName());
    //Blocks
    LogisticsPipes.LogisticsSolidBlock = new LogisticsSolidBlock();
    GameRegistry.registerBlock(LogisticsPipes.LogisticsSolidBlock, LogisticsSolidBlockItem.class, "logisticsSolidBlock");
    LogisticsPipes.LogisticsPipeBlock = new LogisticsBlockGenericPipe();
    GameRegistry.registerBlock(LogisticsPipes.LogisticsPipeBlock, "logisticsPipeBlock");
    LogisticsPipes.LogisticsSubMultiBlock = new LogisticsBlockGenericSubMultiBlock();
    GameRegistry.registerBlock(LogisticsPipes.LogisticsSubMultiBlock, "logisticsSubMultiBlock");
    LogisticsChips = new ItemLogisticsChips();
    LogisticsChips.setUnlocalizedName("logisticsChips");
    GameRegistry.registerItem(LogisticsChips, LogisticsChips.getUnlocalizedName());
    registerPipes(side);
}
Also used : ItemHUDArmor(logisticspipes.items.ItemHUDArmor) FluidContainerRenderer(logisticspipes.renderer.FluidContainerRenderer) ItemUpgrade(logisticspipes.items.ItemUpgrade) ItemPipeController(logisticspipes.items.ItemPipeController) LogisticsBlockGenericPipe(logisticspipes.pipes.basic.LogisticsBlockGenericPipe) LogisticsItemCard(logisticspipes.items.LogisticsItemCard) RemoteOrderer(logisticspipes.items.RemoteOrderer) ItemDisk(logisticspipes.items.ItemDisk) LogisticsFluidContainer(logisticspipes.items.LogisticsFluidContainer) LogisticsBrokenItem(logisticspipes.items.LogisticsBrokenItem) LogisticsSolidBlock(logisticspipes.blocks.LogisticsSolidBlock) ItemPipeSignCreator(logisticspipes.items.ItemPipeSignCreator) ItemParts(logisticspipes.items.ItemParts) ItemLogisticsChips(logisticspipes.items.ItemLogisticsChips) ItemModule(logisticspipes.items.ItemModule) LogisticsBlockGenericSubMultiBlock(logisticspipes.pipes.basic.LogisticsBlockGenericSubMultiBlock)

Example 2 with ItemModule

use of logisticspipes.items.ItemModule in project LogisticsPipes by RS485.

the class PipeLogisticsChassi 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 == null) {
            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);
            next.registerPosition(ModulePositionType.SLOT, i);
            next.registerCCEventQueuer(this);
            if (current != next) {
                _module.installModule(i, next);
                if (!MainProxy.isClient()) {
                    ItemModuleInformationManager.readInformation(stack, next);
                }
                ItemModuleInformationManager.removeInformation(stack);
            }
            inventory.setInventorySlotContents(i, stack);
        }
    }
    if (reInitGui) {
        if (MainProxy.isClient(getWorld())) {
            if (FMLClientHandler.instance().getClient().currentScreen instanceof GuiChassiPipe) {
                FMLClientHandler.instance().getClient().currentScreen.initGui();
            }
        }
    }
    if (MainProxy.isServer()) {
        if (!localModeWatchers.isEmpty()) {
            MainProxy.sendToPlayerList(PacketHandler.getPacket(ChassiePipeModuleContent.class).setIdentList(ItemIdentifierStack.getListFromInventory(_moduleInventory)).setPosX(getX()).setPosY(getY()).setPosZ(getZ()), localModeWatchers);
        }
    }
}
Also used : GuiChassiPipe(logisticspipes.gui.GuiChassiPipe) LogisticsModule(logisticspipes.modules.abstractmodules.LogisticsModule) ItemStack(net.minecraft.item.ItemStack) ItemModule(logisticspipes.items.ItemModule) ChassiePipeModuleContent(logisticspipes.network.packets.pipe.ChassiePipeModuleContent)

Example 3 with ItemModule

use of logisticspipes.items.ItemModule in project LogisticsPipes by RS485.

the class DummyContainer method handleSwitch.

private void handleSwitch(Slot slot2, ItemStack out, ItemStack in, EntityPlayer player) {
    if (slot2 instanceof ModuleSlot) {
        ChassiModule logisticsModule = (ChassiModule) ((ModuleSlot) slot2).get_pipe().getLogisticsModule();
        int moduleIndex = ((ModuleSlot) slot2).get_moduleIndex();
        if (out.getItem() instanceof ItemModule) {
            ItemModuleInformationManager.saveInfotmation(out, logisticsModule.getSubModule(moduleIndex));
            if (logisticsModule.hasModule(moduleIndex)) {
                logisticsModule.removeModule(moduleIndex);
            }
        }
    }
}
Also used : ChassiModule(logisticspipes.modules.ChassiModule) ItemModule(logisticspipes.items.ItemModule)

Aggregations

ItemModule (logisticspipes.items.ItemModule)3 LogisticsSolidBlock (logisticspipes.blocks.LogisticsSolidBlock)1 GuiChassiPipe (logisticspipes.gui.GuiChassiPipe)1 ItemDisk (logisticspipes.items.ItemDisk)1 ItemHUDArmor (logisticspipes.items.ItemHUDArmor)1 ItemLogisticsChips (logisticspipes.items.ItemLogisticsChips)1 ItemParts (logisticspipes.items.ItemParts)1 ItemPipeController (logisticspipes.items.ItemPipeController)1 ItemPipeSignCreator (logisticspipes.items.ItemPipeSignCreator)1 ItemUpgrade (logisticspipes.items.ItemUpgrade)1 LogisticsBrokenItem (logisticspipes.items.LogisticsBrokenItem)1 LogisticsFluidContainer (logisticspipes.items.LogisticsFluidContainer)1 LogisticsItemCard (logisticspipes.items.LogisticsItemCard)1 RemoteOrderer (logisticspipes.items.RemoteOrderer)1 ChassiModule (logisticspipes.modules.ChassiModule)1 LogisticsModule (logisticspipes.modules.abstractmodules.LogisticsModule)1 ChassiePipeModuleContent (logisticspipes.network.packets.pipe.ChassiePipeModuleContent)1 LogisticsBlockGenericPipe (logisticspipes.pipes.basic.LogisticsBlockGenericPipe)1 LogisticsBlockGenericSubMultiBlock (logisticspipes.pipes.basic.LogisticsBlockGenericSubMultiBlock)1 FluidContainerRenderer (logisticspipes.renderer.FluidContainerRenderer)1