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));
}
}
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;
}
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();
}
Aggregations