use of net.minecraftforge.fml.client.config.GuiButtonExt in project Minestuck by mraof.
the class GuiDataChecker method initGui.
@Override
public void initGui() {
int xOffset = (width - GUI_WIDTH) / 2;
int yOffset = (height - GUI_HEIGHT) / 2;
for (int i = 0; i < 5; i++) {
GuiButton button = new GuiButton(i, xOffset + 5, yOffset + LIST_Y + i * 22, 180, 20, "");
buttons[i] = button;
this.buttonList.add(button);
}
returnButton = new GuiButtonExt(5, xOffset + GUI_WIDTH - 25, yOffset + 5, 18, 18, "");
this.buttonList.add(returnButton);
refreshButton = new GuiButtonExt(6, xOffset + GUI_WIDTH - 45, yOffset + 5, 18, 18, "");
this.buttonList.add(refreshButton);
if (activeComponent == null)
MinestuckChannelHandler.sendToServer(MinestuckPacket.makePacket(MinestuckPacket.Type.DATA_CHECKER));
componentChanged();
}
use of net.minecraftforge.fml.client.config.GuiButtonExt in project DynamicSurroundings by OreCruncher.
the class PresetsConfigGui method initGui.
@Override
public void initGui() {
this.presetButtons.clear();
this.tooltips.clear();
this.buttonTips.clear();
this.labelList.clear();
this.buttonList.clear();
this.anchorX = (this.width - REGION_WIDTH) / 2;
this.anchorY = (this.height - REGION_HEIGHT) / 2;
final int titleWidth = this.fontRenderer.getStringWidth(this.TITLE);
final int titleX = this.anchorX + (REGION_WIDTH - titleWidth) / 2;
int Y = this.anchorY + INSET;
final GuiLabel title = new GuiLabel(this.fontRenderer, ID_TITLE, titleX, Y, REGION_WIDTH, BUTTON_HEIGHT, Color.MC_GOLD.rgb());
title.addLine(this.TITLE);
this.labelList.add(title);
Y += INSET + BUTTON_HEIGHT;
final int presetWidth = PRESET_BUTTON_WIDTH + INSET * 2;
final int presetHeight = (int) (PRESET_BUTTON_HEIGHT * (MAX_PRESETS_PAGE + 1.5F)) + INSET;
this.presetPanel.setWidth(presetWidth);
this.presetPanel.setHeight(presetHeight);
for (int i = 0; i < MAX_PRESETS_PAGE; i++) {
final int id = ID_PRESET_BASE + i;
final int x = this.anchorX + MARGIN + INSET;
final int y = Y + i * BUTTON_HEIGHT;
final GuiButtonExt button = new GuiButtonExt(id, x, y, PRESET_BUTTON_WIDTH, PRESET_BUTTON_HEIGHT, "<NOT SET>");
button.visible = false;
this.presetButtons.add(button);
this.tooltips.add(new GuiTooltip(this, button, ""));
}
Y += PRESET_BUTTON_HEIGHT * MAX_PRESETS_PAGE;
this.buttonList.addAll(this.presetButtons);
// Do the previous and next buttons
Y += INSET;
int navButtonX = this.anchorX + MARGIN + NAV_BUTTON_INSET + INSET;
this.previousButton = new GuiButtonExt(ID_PREV_PAGE, navButtonX, Y, NAV_BUTTON_WIDTH, PRESET_BUTTON_HEIGHT, PREV_BUTTON_TEXT);
this.buttonList.add(this.previousButton);
navButtonX = this.anchorX + MARGIN + presetWidth - INSET - NAV_BUTTON_WIDTH - NAV_BUTTON_INSET;
this.nextButton = new GuiButtonExt(ID_NEXT_PAGE, navButtonX, Y, NAV_BUTTON_WIDTH, PRESET_BUTTON_HEIGHT, NEXT_BUTTON_TEXT);
this.buttonList.add(this.nextButton);
// Buttons to the side. Offset is the spacing between the buttons based
// on the preset region size and the number of buttons to render.
final int offset = (presetHeight - 6 * BUTTON_HEIGHT) / 7;
final int buttonsX = this.anchorX + MARGIN + presetWidth + INSET;
int buttonsY = this.anchorY + MARGIN * 2 + INSET + offset;
this.refreshButton = setupButton(ID_REFRESH, buttonsX, buttonsY, "presets.button.Refresh");
buttonsY += BUTTON_HEIGHT + offset;
this.createButton = setupButton(ID_CREATE, buttonsX, buttonsY, "presets.button.Create");
buttonsY += BUTTON_HEIGHT + offset;
this.editButton = setupButton(ID_EDIT, buttonsX, buttonsY, "presets.button.Edit");
buttonsY += BUTTON_HEIGHT + offset;
this.applyButton = setupButton(ID_APPLY, buttonsX, buttonsY, "presets.button.Apply");
buttonsY += BUTTON_HEIGHT + offset;
this.saveButton = setupButton(ID_SAVE, buttonsX, buttonsY, "presets.button.Save");
buttonsY += BUTTON_HEIGHT + offset;
this.deleteButton = setupButton(ID_DELETE, buttonsX, buttonsY, "presets.button.Delete");
// Set the final size of the background panel
this.regionWidth = MARGIN * 2 + presetWidth + INSET + BUTTON_WIDTH;
this.regionHeight = MARGIN * 2 + presetHeight + BUTTON_HEIGHT * 2;
this.backgroundPanel.setWidth(this.regionWidth);
this.backgroundPanel.setHeight(this.regionHeight);
// Done button
final int doneX = (this.regionWidth - BUTTON_WIDTH) / 2 + this.anchorX;
final int doneY = this.anchorY + this.regionHeight - (int) (BUTTON_HEIGHT * 1.5F);
setupButton(ID_DONE, doneX, doneY, "presets.button.Done");
reload();
}
use of net.minecraftforge.fml.client.config.GuiButtonExt in project DynamicSurroundings by OreCruncher.
the class PresetsConfigGui method setupButton.
protected GuiButtonExt setupButton(final int id, final int x, final int y, @Nonnull final String buttonLabel) {
final String label = Localization.format(buttonLabel);
final String tip = Localization.format(buttonLabel + ".tooltip");
final GuiButtonExt button = new GuiButtonExt(id, x, y, BUTTON_WIDTH, BUTTON_HEIGHT, label);
this.buttonList.add(button);
if (!tip.endsWith(".tooltip"))
this.buttonTips.add(new GuiTooltip(this, button, tip));
return button;
}
use of net.minecraftforge.fml.client.config.GuiButtonExt in project DynamicSurroundings by OreCruncher.
the class PresetsConfigGui method setPresetButtonText.
public void setPresetButtonText() {
final int start = this.currentPage * MAX_PRESETS_PAGE;
for (int i = 0; i < MAX_PRESETS_PAGE; i++) {
final GuiButtonExt button = this.presetButtons.get(i);
final int idx = start + i;
if (idx >= this.presets.size()) {
button.visible = false;
} else {
final PresetInfo info = this.presets.get(idx);
button.displayString = info.getTitle();
button.enabled = this.selectedPreset != idx;
button.visible = true;
final StringBuilder builder = new StringBuilder();
builder.append(TextFormatting.GOLD + info.getTitle()).append('\n');
builder.append(TextFormatting.AQUA + info.getFilename());
if (info.isRestartRequired())
builder.append('\n').append(this.TOOLTIP_RESTART_REQUIRED);
if (!StringUtils.isEmpty(info.getDescription().trim()))
builder.append("\n\n").append(TextFormatting.RESET).append(info.getDescription());
this.tooltips.set(i, new GuiTooltip(this, button, builder.toString(), PRESET_TOOLTIP_WIDTH));
}
}
updateButtonState();
}
use of net.minecraftforge.fml.client.config.GuiButtonExt in project Cavern2 by kegare.
the class GuiRegeneration method initGui.
@Override
public void initGui() {
if (regenButton == null) {
regenButton = new GuiButtonExt(0, 0, 0, I18n.format("cavern.regeneration.gui.regenerate"));
}
regenButton.x = width / 2 - 100;
regenButton.y = height / 4 + regenButton.height + 65;
if (cancelButton == null) {
cancelButton = new GuiButtonExt(1, 0, 0, I18n.format("gui.cancel"));
}
cancelButton.x = regenButton.x;
cancelButton.y = regenButton.y + regenButton.height + 5;
if (backupCheckBox == null) {
backupCheckBox = new GuiCheckBox(2, 10, 0, I18n.format("cavern.regeneration.gui.backup"), backup);
}
backupCheckBox.y = height - 20;
if (cavernCheckBox == null) {
cavernCheckBox = new GuiCheckBox(3, 10, 8, I18n.format("dimension.cavern.name"), dimensions.contains(CaveDimensions.CAVERN));
}
if (CaveDimensions.CAVERN == null) {
cavernCheckBox.enabled = false;
cavernCheckBox.setIsChecked(false);
}
GuiButton before = cavernCheckBox;
if (hugeCavernCheckBox == null) {
hugeCavernCheckBox = new GuiCheckBox(4, 10, before.y + before.height + 5, I18n.format("dimension.hugeCavern.name"), dimensions.contains(CaveDimensions.HUGE_CAVERN));
}
if (CaveDimensions.HUGE_CAVERN == null) {
hugeCavernCheckBox.enabled = false;
hugeCavernCheckBox.setIsChecked(false);
}
before = hugeCavernCheckBox;
if (aquaCavernCheckBox == null) {
aquaCavernCheckBox = new GuiCheckBox(5, 10, before.y + before.height + 5, I18n.format("dimension.aquaCavern.name"), dimensions.contains(CaveDimensions.AQUA_CAVERN));
}
if (CaveDimensions.AQUA_CAVERN == null) {
aquaCavernCheckBox.enabled = false;
aquaCavernCheckBox.setIsChecked(false);
}
before = aquaCavernCheckBox;
String mirage = CaveItems.MIRAGE_BOOK.getUnlocalizedName();
if (cavelandCheckBox == null) {
cavelandCheckBox = new GuiCheckBox(6, 10, before.y + before.height + 5, I18n.format(mirage + ".caveland.name"), dimensions.contains(CaveDimensions.CAVELAND));
}
if (CaveDimensions.CAVELAND == null) {
cavelandCheckBox.enabled = false;
cavelandCheckBox.setIsChecked(false);
}
before = cavelandCheckBox;
if (caveniaCheckBox == null) {
caveniaCheckBox = new GuiCheckBox(7, 10, before.y + before.height + 5, I18n.format(mirage + ".cavenia.name"), dimensions.contains(CaveDimensions.CAVENIA));
}
if (CaveDimensions.CAVENIA == null) {
caveniaCheckBox.enabled = false;
caveniaCheckBox.setIsChecked(false);
}
before = caveniaCheckBox;
if (frostMountainsCheckBox == null) {
frostMountainsCheckBox = new GuiCheckBox(8, 10, before.y + before.height + 5, I18n.format(mirage + ".frostMountains.name"), dimensions.contains(CaveDimensions.FROST_MOUNTAINS));
}
if (CaveDimensions.FROST_MOUNTAINS == null) {
frostMountainsCheckBox.enabled = false;
frostMountainsCheckBox.setIsChecked(false);
}
before = frostMountainsCheckBox;
if (wideDesertCheckBox == null) {
wideDesertCheckBox = new GuiCheckBox(9, 10, before.y + before.height + 5, I18n.format(mirage + ".wideDesert.name"), dimensions.contains(CaveDimensions.WIDE_DESERT));
}
if (CaveDimensions.WIDE_DESERT == null) {
wideDesertCheckBox.enabled = false;
wideDesertCheckBox.setIsChecked(false);
}
before = wideDesertCheckBox;
if (theVoidCheckBox == null) {
theVoidCheckBox = new GuiCheckBox(10, 10, before.y + before.height + 5, I18n.format(mirage + ".theVoid.name"), dimensions.contains(CaveDimensions.THE_VOID));
}
if (CaveDimensions.THE_VOID == null) {
theVoidCheckBox.enabled = false;
theVoidCheckBox.setIsChecked(false);
}
before = theVoidCheckBox;
if (darkForestCheckBox == null) {
darkForestCheckBox = new GuiCheckBox(11, 10, before.y + before.height + 5, I18n.format(mirage + ".darkForest.name"), dimensions.contains(CaveDimensions.DARK_FOREST));
}
if (CaveDimensions.DARK_FOREST == null) {
darkForestCheckBox.enabled = false;
darkForestCheckBox.setIsChecked(false);
}
before = darkForestCheckBox;
if (crownCliffsCheckBox == null) {
crownCliffsCheckBox = new GuiCheckBox(12, 10, before.y + before.height + 5, I18n.format(mirage + ".crownCliffs.name"), dimensions.contains(CaveDimensions.CROWN_CLIFFS));
}
if (CaveDimensions.CROWN_CLIFFS == null) {
crownCliffsCheckBox.enabled = false;
crownCliffsCheckBox.setIsChecked(false);
}
before = crownCliffsCheckBox;
buttonList.clear();
buttonList.add(regenButton);
buttonList.add(cancelButton);
buttonList.add(backupCheckBox);
buttonList.add(cavernCheckBox);
buttonList.add(hugeCavernCheckBox);
buttonList.add(aquaCavernCheckBox);
buttonList.add(cavelandCheckBox);
buttonList.add(caveniaCheckBox);
buttonList.add(frostMountainsCheckBox);
buttonList.add(wideDesertCheckBox);
buttonList.add(theVoidCheckBox);
buttonList.add(darkForestCheckBox);
buttonList.add(crownCliffsCheckBox);
if (backupHoverChecker == null) {
backupHoverChecker = new HoverChecker(backupCheckBox, 800);
}
}
Aggregations