Search in sources :

Example 1 with ItemEngineersBlueprint

use of blusunrize.immersiveengineering.common.items.ItemEngineersBlueprint in project ImmersiveEngineering by BluSunrize.

the class GuiAutoWorkbench method initGui.

@Override
public void initGui() {
    this.buttonList.clear();
    super.initGui();
    Slot s = inventorySlots.getSlot(0);
    if (s != null && s.getHasStack() && s.getStack().getItem() instanceof ItemEngineersBlueprint) {
        BlueprintCraftingRecipe[] recipes = BlueprintCraftingRecipe.findRecipes(ItemNBTHelper.getString(s.getStack(), "blueprint"));
        if (recipes != null && recipes.length > 0) {
            int l = recipes.length;
            int xx = guiLeft + 121;
            int yy = guiTop + (l > 6 ? 59 - (l - 3) / 3 * 18 : l > 3 ? 59 : 68);
            for (int i = 0; i < l; i++) if (recipes[i] != null && recipes[i].output != null) {
                this.buttonList.add(new GuiButtonItem(i, xx + (i % 3) * 18, yy + (i / 3) * 18, recipes[i].output.copy(), i == tile.selectedRecipe));
            }
        }
    //			ItemStack stack = s.getStack();
    //			IConfigurableTool tool = ((IConfigurableTool)stack.getItem());
    //			int buttonid = 0;
    //			ToolConfigBoolean[] boolArray = tool.getBooleanOptions(stack);
    //			if(boolArray!=null)
    //				for(ToolConfigBoolean b : boolArray)
    //					this.buttonList.add(new GuiButtonCheckbox(buttonid++, guiLeft+b.x,guiTop+b.y, tool.fomatConfigName(stack,b), b.value));
    //			ToolConfigFloat[] floatArray = tool.getFloatOptions(stack);
    //			if(floatArray!=null)
    //				for(ToolConfigFloat f : floatArray)
    //					this.buttonList.add(new GuiSliderIE(buttonid++, guiLeft+f.x,guiTop+f.y, 80, tool.fomatConfigName(stack,f), f.value));
    }
}
Also used : GuiButtonItem(blusunrize.immersiveengineering.client.gui.elements.GuiButtonItem) BlueprintCraftingRecipe(blusunrize.immersiveengineering.api.crafting.BlueprintCraftingRecipe) ItemEngineersBlueprint(blusunrize.immersiveengineering.common.items.ItemEngineersBlueprint) Slot(net.minecraft.inventory.Slot) ItemEngineersBlueprint(blusunrize.immersiveengineering.common.items.ItemEngineersBlueprint)

Example 2 with ItemEngineersBlueprint

use of blusunrize.immersiveengineering.common.items.ItemEngineersBlueprint in project ImmersiveEngineering by BluSunrize.

the class ContainerAutoWorkbench method transferStackInSlot.

//	public void rebindSlots()
//	{
//
//		ImmersiveEngineering.proxy.reInitGui();
//	}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
    ItemStack stack = null;
    Slot slotObject = inventorySlots.get(slot);
    if (slotObject != null && slotObject.getHasStack()) {
        ItemStack stackInSlot = slotObject.getStack();
        stack = stackInSlot.copy();
        if (slot < slotCount) {
            if (!this.mergeItemStack(stackInSlot, slotCount, (slotCount + 36), true))
                return null;
        } else if (stackInSlot != null) {
            if (stackInSlot.getItem() instanceof ItemEngineersBlueprint) {
                if (!this.mergeItemStack(stackInSlot, 0, 1, true))
                    return null;
            } else {
                boolean b = true;
                for (int i = 1; i < slotCount; i++) {
                    Slot s = inventorySlots.get(i);
                    if (s != null && s.isItemValid(stackInSlot))
                        if (this.mergeItemStack(stackInSlot, i, i + 1, true)) {
                            b = false;
                            break;
                        } else
                            continue;
                }
                if (b)
                    return null;
            }
        }
        if (stackInSlot.stackSize == 0)
            slotObject.putStack(null);
        else
            slotObject.onSlotChanged();
        if (stackInSlot.stackSize == stack.stackSize)
            return null;
        slotObject.onPickupFromSlot(player, stack);
    }
    return stack;
}
Also used : ItemEngineersBlueprint(blusunrize.immersiveengineering.common.items.ItemEngineersBlueprint) Slot(net.minecraft.inventory.Slot) ItemStack(net.minecraft.item.ItemStack)

Example 3 with ItemEngineersBlueprint

use of blusunrize.immersiveengineering.common.items.ItemEngineersBlueprint in project ImmersiveEngineering by BluSunrize.

the class ContainerModWorkbench method rebindSlots.

public void rebindSlots() {
    this.inventorySlots.clear();
    this.addSlotToContainer(new IESlot.UpgradeableItem(this, this.inv, 0, 24, 22, 1));
    slotCount = 1;
    ItemStack tool = this.getSlot(0).getStack();
    if (tool != null) {
        if (tool.getItem() instanceof IUpgradeableTool) {
            if (tool.getItem() instanceof ItemEngineersBlueprint)
                ((ItemEngineersBlueprint) tool.getItem()).updateOutputs(tool);
            this.toolInv = new InventoryStorageItem(this, tool);
            Slot[] slots = ((IUpgradeableTool) tool.getItem()).getWorkbenchSlots(this, tool, toolInv);
            if (slots != null)
                for (Slot s : slots) {
                    this.addSlotToContainer(s);
                    slotCount++;
                }
            ItemStack[] cont = ((IUpgradeableTool) tool.getItem()).getContainedItems(tool);
            this.toolInv.stackList = cont;
        }
        if (tool.hasCapability(CapabilityShader.SHADER_CAPABILITY, null)) {
            ShaderWrapper wrapper = tool.getCapability(CapabilityShader.SHADER_CAPABILITY, null);
            if (wrapper != null) {
                this.shaderInv = new InventoryShader(this, wrapper);
                this.addSlotToContainer(new IESlot.Shader(this, shaderInv, 0, 130, 32, tool));
                slotCount++;
                this.shaderInv.shader = wrapper.getShaderItem();
            }
        }
    }
    bindPlayerInv(inventoryPlayer);
    ImmersiveEngineering.proxy.reInitGui();
}
Also used : ItemEngineersBlueprint(blusunrize.immersiveengineering.common.items.ItemEngineersBlueprint) ShaderWrapper(blusunrize.immersiveengineering.api.shader.CapabilityShader.ShaderWrapper) IUpgradeableTool(blusunrize.immersiveengineering.api.tool.IUpgradeableTool) Slot(net.minecraft.inventory.Slot) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemEngineersBlueprint (blusunrize.immersiveengineering.common.items.ItemEngineersBlueprint)3 Slot (net.minecraft.inventory.Slot)3 ItemStack (net.minecraft.item.ItemStack)2 BlueprintCraftingRecipe (blusunrize.immersiveengineering.api.crafting.BlueprintCraftingRecipe)1 ShaderWrapper (blusunrize.immersiveengineering.api.shader.CapabilityShader.ShaderWrapper)1 IUpgradeableTool (blusunrize.immersiveengineering.api.tool.IUpgradeableTool)1 GuiButtonItem (blusunrize.immersiveengineering.client.gui.elements.GuiButtonItem)1