use of blusunrize.immersiveengineering.api.tool.IConfigurableTool.ToolConfig.ToolConfigFloat in project ImmersiveEngineering by BluSunrize.
the class GuiModWorkbench method mouseReleased.
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
Slot s = inventorySlots.getSlot(0);
if (s != null && s.getHasStack() && s.getStack().getItem() instanceof IConfigurableTool) {
ItemStack stack = s.getStack();
IConfigurableTool tool = ((IConfigurableTool) stack.getItem());
NBTTagCompound message = new NBTTagCompound();
ToolConfigBoolean[] boolArray = tool.getBooleanOptions(stack);
int iBool = 0;
ToolConfigFloat[] floatArray = tool.getFloatOptions(stack);
int iFloat = 0;
for (GuiButton button : this.buttonList) {
if (button instanceof GuiButtonCheckbox && boolArray != null)
message.setBoolean("b_" + boolArray[iBool++].name, ((GuiButtonCheckbox) button).state);
if (button instanceof GuiSliderIE && floatArray != null)
message.setFloat("f_" + floatArray[iFloat++].name, (float) ((GuiSliderIE) button).sliderValue);
}
if (//Only send packets when values have changed
lastMessage == null || !lastMessage.equals(message))
ImmersiveEngineering.packetHandler.sendToServer(new MessageTileSync(this.workbench, message));
lastMessage = message;
}
}
use of blusunrize.immersiveengineering.api.tool.IConfigurableTool.ToolConfig.ToolConfigFloat in project ImmersiveEngineering by BluSunrize.
the class ItemFluorescentTube method getFloatOptions.
@Override
public ToolConfigFloat[] getFloatOptions(ItemStack stack) {
ToolConfigFloat[] ret = new ToolConfigFloat[3];
float[] rgb = getRGB(stack);
ret[0] = new ToolConfigFloat("red", 60, 20, rgb[0]);
ret[1] = new ToolConfigFloat("green", 60, 40, rgb[1]);
ret[2] = new ToolConfigFloat("blue", 60, 60, rgb[2]);
return ret;
}
use of blusunrize.immersiveengineering.api.tool.IConfigurableTool.ToolConfig.ToolConfigFloat in project ImmersiveEngineering by BluSunrize.
the class GuiModWorkbench 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 IConfigurableTool) {
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