use of mcjty.lib.gui.widgets.Widget in project RFToolsControl by McJty.
the class FluidEditor method build.
@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
Panel constantPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
Label<?> label = new Label(mc, gui).setText("Drop bucket:");
constantPanel.addChild(label);
blockRender = new BlockRender(mc, gui).setDesiredWidth(18 + 100).setDesiredHeight(18).setFilledRectThickness(1).setFilledBackground(0xff555555).setShowLabel(true);
constantPanel.addChild(blockRender);
blockRender.addSelectionEvent(new BlockRenderEvent() {
@Override
public void select(Widget widget) {
ItemStack holding = Minecraft.getMinecraft().player.inventory.getItemStack();
if (holding.isEmpty()) {
blockRender.setRenderItem(null);
} else {
blockRender.setRenderItem(stackToFluid(holding));
}
callback.valueChanged(readValue());
}
@Override
public void doubleClick(Widget widget) {
}
});
createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_FLUID);
}
use of mcjty.lib.gui.widgets.Widget in project RFToolsControl by McJty.
the class ItemEditor method build.
@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
Panel constantPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
Label<?> label = new Label(mc, gui).setText("Drop item:");
constantPanel.addChild(label);
blockRender = new BlockRender(mc, gui).setDesiredWidth(18 + 100).setDesiredHeight(18).setFilledRectThickness(1).setFilledBackground(0xff555555).setShowLabel(true);
constantPanel.addChild(blockRender);
blockRender.addSelectionEvent(new BlockRenderEvent() {
@Override
public void select(Widget widget) {
ItemStack holding = Minecraft.getMinecraft().player.inventory.getItemStack();
if (holding.isEmpty()) {
blockRender.setRenderItem(null);
} else {
ItemStack copy = holding.copy();
copy.setCount(1);
blockRender.setRenderItem(copy);
}
callback.valueChanged(readValue());
}
@Override
public void doubleClick(Widget widget) {
}
});
createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_ITEM);
}
Aggregations