use of net.minecraft.client.gui.GuiButton in project Pearcel-Mod by MiningMark48.
the class GuiCatItems method initGui.
@Override
public void initGui() {
super.initGui();
buttonList.clear();
int offsetFromScreenLeft = (width - textureWidth) / 2;
buttonList.add(buttonNextPage = new ComponentNextPageButton(1, offsetFromScreenLeft + 120, 158, true));
buttonList.add(buttonPreviousPage = new ComponentNextPageButton(1, offsetFromScreenLeft + 38, 158, false));
buttonHome = new GuiButton(2, (width / 2) - 20, textureHeight, 40, 20, Translate.toLocal("gui.manual.button.home"));
buttonList.add(buttonHome);
for (GuiButton e : buttonList) {
e.visible = false;
}
}
use of net.minecraft.client.gui.GuiButton in project Pearcel-Mod by MiningMark48.
the class GuiCatTools method initGui.
@Override
public void initGui() {
super.initGui();
buttonList.clear();
int offsetFromScreenLeft = (width - textureWidth) / 2;
buttonList.add(buttonNextPage = new ComponentNextPageButton(1, offsetFromScreenLeft + 120, 158, true));
buttonList.add(buttonPreviousPage = new ComponentNextPageButton(1, offsetFromScreenLeft + 38, 158, false));
buttonHome = new GuiButton(2, (width / 2) - 20, textureHeight, 40, 20, Translate.toLocal("gui.manual.button.home"));
buttonList.add(buttonHome);
for (GuiButton e : buttonList) {
e.visible = false;
}
}
use of net.minecraft.client.gui.GuiButton in project ArsMagica2 by Mithion.
the class AuraCustomizationMenu method mouseClicked.
@Override
protected void mouseClicked(int x, int y, int button) {
GuiButton clickedBtn = getControlByXY(x, y);
if (clickedBtn != null && button == 1) {
if (clickedBtn.id == 10) {
int index = AMCore.config.getAuraIndex();
index--;
if (index < 0)
index = AMParticle.particleTypes.length - 1;
while (AMParticle.particleTypes[index].startsWith("lightning_bolt") && AMCore.proxy.playerTracker.getAAL(Minecraft.getMinecraft().thePlayer) < 3) {
index--;
if (index < 0)
index = AMParticle.particleTypes.length - 1;
}
AMCore.config.setAuraIndex(index);
btnParticleType.displayString = AMParticle.particleTypes[index];
} else if (clickedBtn.id == 11) {
int index = AMCore.config.getAuraBehaviour();
index--;
if (index < 0)
index = ParticleController.AuraControllerOptions.length - 1;
AMCore.config.setAuraBehaviour(index);
btnParticleBehaviour.displayString = ParticleController.AuraControllerOptions[index];
}
}
super.mouseClicked(x, y, button);
}
use of net.minecraft.client.gui.GuiButton in project OpenModularTurrets by OpenModularTurretsTeam.
the class ConfigureGui method initGui.
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
this.buttonList.clear();
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
String mobsButton = safeLocalize(OMTNames.Localizations.GUI.ATTACK_MOBS) + ": " + (getColoredBooleanLocalizationYesNo(base.isAttacksMobs()));
String neutralsButton = safeLocalize(OMTNames.Localizations.GUI.ATTACK_NEUTRALS) + ": " + (getColoredBooleanLocalizationYesNo(base.isAttacksNeutrals()));
String playersButton = safeLocalize(OMTNames.Localizations.GUI.ATTACK_PLAYERS) + ": " + (getColoredBooleanLocalizationYesNo(base.isAttacksPlayers()));
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
textFieldAddTrustedPlayer = new GuiTextField(0, fontRenderer, 11, 99, 100, 18);
textFieldAddTrustedPlayer.setMaxStringLength(50);
textFieldAddTrustedPlayer.setFocused(true);
this.buttonList.add(new GuiButton(1, x + 10, y + 20, 155, 20, mobsButton));
this.buttonList.add(new GuiButton(2, x + 10, y + 40, 155, 20, neutralsButton));
this.buttonList.add(new GuiButton(3, x + 10, y + 60, 155, 20, playersButton));
this.buttonList.add(new GuiButton(4, x + 114, y + 98, 51, 20, "+"));
this.buttonList.add(new GuiButton(5, x + 35, y + 135, 30, 20, "-"));
this.buttonList.add(new GuiButton(6, x + 10, y + 135, 20, 20, "<<"));
this.buttonList.add(new GuiButton(7, x + 145, y + 135, 20, 20, ">>"));
if (this.base.getTrustedPlayers().size() > 0) {
this.buttonList.add(new GuiButton(8, x + 70, y + 135, 23, 20, this.base.getTrustedPlayers().get(base.trustedPlayerIndex).canOpenGUI ? "§2Y" : "§cN"));
this.buttonList.add(new GuiButton(9, x + 93, y + 135, 23, 20, this.base.getTrustedPlayers().get(base.trustedPlayerIndex).canChangeTargeting ? "§2Y" : "§cN"));
this.buttonList.add(new GuiButton(10, x + 116, y + 135, 23, 20, this.base.getTrustedPlayers().get(base.trustedPlayerIndex).admin ? "§2Y" : "§cN"));
} else {
this.buttonList.add(new GuiButton(8, x + 70, y + 135, 23, 20, "?"));
this.buttonList.add(new GuiButton(9, x + 93, y + 135, 23, 20, "?"));
this.buttonList.add(new GuiButton(10, x + 116, y + 135, 23, 20, "?"));
}
}
use of net.minecraft.client.gui.GuiButton 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;
}
}
Aggregations