use of blusunrize.immersiveengineering.client.gui.elements.GuiButtonItem in project ImmersiveEngineering by BluSunrize.
the class GuiAutoWorkbench method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if (button instanceof GuiButtonItem) {
if (//disable
button.id == tile.selectedRecipe)
tile.selectedRecipe = -1;
else
tile.selectedRecipe = button.id;
NBTTagCompound message = new NBTTagCompound();
message.setInteger("recipe", tile.selectedRecipe);
ImmersiveEngineering.packetHandler.sendToServer(new MessageTileSync(this.tile, message));
initGui();
}
}
use of blusunrize.immersiveengineering.client.gui.elements.GuiButtonItem 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));
}
}
Aggregations