use of net.minecraft.client.gui.GuiButton in project MineFactoryReloaded by powercrystals.
the class GuiEnchantmentRouter method initGui.
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
int xOffset = (this.width - this.xSize) / 2;
int yOffset = (this.height - this.ySize) / 2;
_matchLevels = new GuiButton(1, xOffset + 7, yOffset + 15, 100, 20, "Match Levels: NO");
buttonList.add(_matchLevels);
}
use of net.minecraft.client.gui.GuiButton in project MineFactoryReloaded by powercrystals.
the class GuiItemRouter method initGui.
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
int xOffset = (this.width - this.xSize) / 2;
int yOffset = (this.height - this.ySize) / 2;
_matchLevels = new GuiButton(1, xOffset + 7, yOffset + 15, 120, 20, "Reject Unmapped: NO");
buttonList.add(_matchLevels);
}
use of net.minecraft.client.gui.GuiButton in project watson by totemo.
the class WatsonConfigPanel method mousePressed.
// --------------------------------------------------------------------------
/**
* @see com.mumfrey.liteloader.modconfig.ConfigPanel#mousePressed(com.mumfrey.liteloader.modconfig.ConfigPanelHost,
* int, int, int)
*/
@Override
public void mousePressed(ConfigPanelHost host, int mouseX, int mouseY, int mouseButton) {
if (_focusedControl != null && _focusedControl instanceof KeyBindingButton) {
KeyBindingButton button = (KeyBindingButton) _focusedControl;
// A control is capturing all input. Set a bound key.
int keyCode = (mouseButton == 0) ? MouseButton.MOUSE_LEFT.getCode() : (mouseButton == 1) ? MouseButton.MOUSE_RIGHT.getCode() : MouseButton.MOUSE_MIDDLE.getCode();
setModifiedKeyBinding(button.getKeyBinding(), keyCode);
} else {
Minecraft mc = Minecraft.getMinecraft();
// Iterate over all the controls and pass the mouse press to the control
for (GuiButton control : _keyButtons) {
// enabled and visible, and the mouse coords are within the control.
if (control.mousePressed(mc, mouseX, mouseY)) {
control.playPressSound(mc.getSoundHandler());
Runnable handler = _handlers.get(control.id);
if (handler != null) {
handler.run();
}
break;
}
}
// for
}
// no control has focus
}
use of net.minecraft.client.gui.GuiButton in project watson by totemo.
the class WatsonGuiScreen method initGui.
// --------------------------------------------------------------------------
/**
* @see GuiScreen#initGui()
*/
@SuppressWarnings("unchecked")
@Override
public void initGui() {
Minecraft mc = Minecraft.getMinecraft();
FontRenderer fr = mc.fontRendererObj;
_rowHeight = (int) (fr.FONT_HEIGHT * 2.75);
int startY = height / 2 - 4 * _rowHeight;
int currentRow = 0;
buttonList.clear();
buttonList.add(new GuiButton(ID_SHOW_WATSON, width / 2 - 175, startY + currentRow * _rowHeight, 150, 20, getButtonLabel(ID_SHOW_WATSON)));
buttonList.add(new GuiButton(ID_CLEAR_EDITS, width / 2 + 25, startY + currentRow++ * _rowHeight, 150, 20, getButtonLabel(ID_CLEAR_EDITS)));
buttonList.add(new GuiButton(ID_SHOW_VECTORS, width / 2 - 175, startY + currentRow * _rowHeight, 150, 20, getButtonLabel(ID_SHOW_VECTORS)));
GuiResponder sliderResponder = new GuiPageButtonList.GuiResponder() {
@Override
public void onTick(int id, float value) {
// Update the display when the slider slides. Save the new length in
// the configuration when the GUI closes.
DisplaySettings ds = Controller.instance.getDisplaySettings();
ds.setMinVectorLength((int) value, false);
}
@Override
public void func_175321_a(int id, boolean value) {
}
@Override
public void func_175319_a(int id, String value) {
}
};
Configuration config = Configuration.instance;
GuiSlider slider = new GuiSlider(sliderResponder, ID_MIN_VECTOR_LENGTH, width / 2 + 25, startY + currentRow++ * _rowHeight, "Min Vector Length", 0, 20, config.getVectorLength(), new GuiSlider.FormatHelper() {
@Override
public String getText(int id, String name, float value) {
return "Min Vector Length: " + Integer.toString((int) value);
}
});
buttonList.add(slider);
buttonList.add(new GuiButton(ID_SHOW_LABELS, width / 2 - 175, startY + currentRow * _rowHeight, 150, 20, getButtonLabel(ID_SHOW_LABELS)));
buttonList.add(new GuiButton(ID_LABEL_ORDER, width / 2 + 25, startY + currentRow++ * _rowHeight, 150, 20, getButtonLabel(ID_LABEL_ORDER)));
buttonList.add(new GuiButton(ID_SHOW_ANNOTATIONS, width / 2 - 175, startY + currentRow * _rowHeight, 150, 20, getButtonLabel(ID_SHOW_ANNOTATIONS)));
buttonList.add(new GuiButton(ID_SHOW_SELECTION, width / 2 + 25, startY + currentRow++ * _rowHeight, 150, 20, getButtonLabel(ID_SHOW_SELECTION)));
buttonList.add(new GuiOptionButton(ID_DONE, width / 2 - 40, startY + (currentRow + 2) * _rowHeight, 80, 20, I18n.format("gui.done", new Object[0])));
enableButtons();
}
use of net.minecraft.client.gui.GuiButton in project LogisticsPipes by RS485.
the class LogisticsBaseGuiScreen method mouseClicked.
@Override
protected void mouseClicked(int par1, int par2, int par3) {
for (IRenderSlot slot : slots) {
int mouseX = par1 - guiLeft;
int mouseY = par2 - guiTop;
int mouseXMax = mouseX - slot.getSize();
int mouseYMax = mouseY - slot.getSize();
if (slot.getXPos() < mouseX && slot.getXPos() > mouseXMax && slot.getYPos() < mouseY && slot.getYPos() > mouseYMax) {
slot.mouseClicked(par3);
return;
}
}
if (isMouseInFuzzyPanel(par1, par2)) {
final int posX = fuzzySlot.getX() + guiLeft;
final int posY = fuzzySlot.getY() + 17 + guiTop;
int sel = -1;
if (par1 >= posX + 4 && par1 <= posX + 60 - 4) {
if (par2 >= posY + 4 && par2 <= posY + 52 - 4) {
sel = (par2 - posY - 4) / 11;
}
}
DictResource resource = fuzzySlot.getFuzzyFlags();
BitSet set = resource.getBitSet();
if (sel == 0) {
resource.use_od = !resource.use_od;
}
if (sel == 1) {
resource.ignore_dmg = !resource.ignore_dmg;
}
if (sel == 2) {
resource.ignore_nbt = !resource.ignore_nbt;
}
if (sel == 3) {
resource.use_category = !resource.use_category;
}
MainProxy.sendPacketToServer(PacketHandler.getPacket(FuzzySlotSettingsPacket.class).setSlotNumber(fuzzySlot.getSlotId()).setFlags(resource.getBitSet()));
// Reset to wait for server
resource.loadFromBitSet(set);
return;
}
boolean handledButton = false;
if (par3 == 0) {
for (Object aButtonList : buttonList) {
GuiButton guibutton = (GuiButton) aButtonList;
if (guibutton.mousePressed(mc, par1, par2)) {
selectedButton = guibutton;
guibutton.func_146113_a(mc.getSoundHandler());
actionPerformed(guibutton);
handledButton = true;
break;
}
}
}
if (!handledButton) {
super.mouseClicked(par1, par2, par3);
}
if (par3 == 0 && par1 < guiLeft && !mouseCanPressButton(par1, par2) && !isOverSlot(par1, par2)) {
extentionControllerLeft.mouseClicked(par1, par2, par3);
}
if (par3 == 0 && par1 > guiLeft + xSize && !mouseCanPressButton(par1, par2) && !isOverSlot(par1, par2)) {
extentionControllerRight.mouseClicked(par1, par2, par3);
}
}
Aggregations