use of net.minecraft.client.gui.Gui in project BuildCraft by BuildCraft.
the class GuiUtil method drawTexturedModalRect.
public static void drawTexturedModalRect(double posX, double posY, double textureX, double textureY, double width, double height) {
int x = MathHelper.floor(posX);
int y = MathHelper.floor(posY);
int u = MathHelper.floor(textureX);
int v = MathHelper.floor(textureY);
int w = MathHelper.floor(width);
int h = MathHelper.floor(height);
Gui gui = Minecraft.getMinecraft().currentScreen;
gui.drawTexturedModalRect(x, y, u, v, w, h);
}
use of net.minecraft.client.gui.Gui in project RFTools by McJty.
the class MachineInformationClientScreenModule method createGui.
@Override
public void createGui(IModuleGuiBuilder guiBuilder) {
// @todo Hacky, solve this better
ScreenModuleGuiBuilder screenModuleGuiBuilder = (ScreenModuleGuiBuilder) guiBuilder;
Minecraft mc = Minecraft.getMinecraft();
Gui gui = screenModuleGuiBuilder.getGui();
NBTTagCompound currentData = screenModuleGuiBuilder.getCurrentData();
IModuleGuiChanged moduleGuiChanged = screenModuleGuiBuilder.getModuleGuiChanged();
Panel panel = new Panel(mc, gui).setLayout(new VerticalLayout());
TextField textField = new TextField(mc, gui).setDesiredHeight(16).setTooltips("Text to use as label").addTextEvent((parent, newText) -> {
currentData.setString("text", newText);
moduleGuiChanged.updateData();
});
panel.addChild(textField);
addColorPanel(mc, gui, currentData, moduleGuiChanged, panel);
addOptionPanel(mc, gui, currentData, moduleGuiChanged, panel);
addMonitorPanel(mc, gui, currentData, panel);
if (currentData != null) {
textField.setText(currentData.getString("text"));
}
screenModuleGuiBuilder.overridePanel(panel);
}
use of net.minecraft.client.gui.Gui in project RFToolsControl by McJty.
the class GuiTools method askSomething.
public static void askSomething(Minecraft mc, Gui gui, WindowManager windowManager, int x, int y, String title, String initialValue, Consumer<String> callback) {
Panel ask = new Panel(mc, gui).setLayout(new VerticalLayout()).setFilledBackground(0xff666666, 0xffaaaaaa).setFilledRectThickness(1);
ask.setBounds(new Rectangle(x, y, 100, 60));
Window askWindow = windowManager.createModalWindow(ask);
ask.addChild(new Label(mc, gui).setText(title));
TextField input = new mcjty.lib.gui.widgets.TextField(mc, gui).addTextEnterEvent(((parent, newText) -> {
windowManager.closeWindow(askWindow);
callback.accept(newText);
}));
input.setText(initialValue);
ask.addChild(input);
Panel buttons = new Panel(mc, gui).setLayout(new HorizontalLayout()).setDesiredWidth(100).setDesiredHeight(18);
buttons.addChild(new Button(mc, gui).setText("Ok").addButtonEvent((parent -> {
windowManager.closeWindow(askWindow);
callback.accept(input.getText());
})));
buttons.addChild(new Button(mc, gui).setText("Cancel").addButtonEvent((parent -> {
windowManager.closeWindow(askWindow);
})));
ask.addChild(buttons);
}
use of net.minecraft.client.gui.Gui in project RFToolsControl by McJty.
the class LongEditor method build.
@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
Panel constantPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
field = new TextField(mc, gui).addTextEvent((parent, newText) -> callback.valueChanged(readValue())).addTextEnterEvent((parent, newText) -> closeWindow());
constantPanel.addChild(field);
hexMode = new ToggleButton(mc, gui).addButtonEvent(widget -> updateHex()).setCheckMarker(true).setText("Hex");
constantPanel.addChild(hexMode);
createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_LONG);
}
use of net.minecraft.client.gui.Gui in project RFToolsControl by McJty.
the class SideEditor method build.
@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
Panel constantPanel = new Panel(mc, gui).setLayout(new VerticalLayout());
nameLabel = new TextField(mc, gui).addTextEvent((o, text) -> callback.valueChanged(readValue())).addTextEnterEvent((parent, newText) -> closeWindow()).setDesiredWidth(50).setDesiredHeight(14);
constantPanel.addChild(createLabeledPanel(mc, gui, "Node name:", nameLabel, "Optional name of a node in the network"));
label = new ChoiceLabel(mc, gui).addChoices("*", "Down", "Up", "North", "South", "West", "East").addChoiceEvent((parent, newChoice) -> callback.valueChanged(readValue())).setDesiredWidth(60);
constantPanel.addChild(createLabeledPanel(mc, gui, "Side:", label, "Side relative to processor or node", "for the desired block"));
createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_SIDE);
}
Aggregations