Search in sources :

Example 21 with GuiButtonExt

use of net.minecraftforge.fml.client.config.GuiButtonExt in project Cavern2 by kegare.

the class GuiVeinsEditor method initGui.

@Override
public void initGui() {
    if (veinList == null) {
        veinList = new VeinList();
        refreshVeins(manager.getCaveVeins());
    }
    veinList.setDimensions(width, height, 32, height - (editMode ? 170 : 28));
    if (doneButton == null) {
        doneButton = new GuiButtonExt(0, 0, 0, 65, 20, I18n.format("gui.done"));
    }
    doneButton.x = width / 2 + 135;
    doneButton.y = height - doneButton.height - 4;
    if (editButton == null) {
        editButton = new GuiButtonExt(1, 0, 0, doneButton.width, doneButton.height, I18n.format("gui.edit"));
        editButton.enabled = false;
    }
    editButton.x = doneButton.x - doneButton.width - 3;
    editButton.y = doneButton.y;
    editButton.enabled = veinList.selected != null;
    editButton.visible = !editMode;
    if (cancelButton == null) {
        cancelButton = new GuiButtonExt(2, 0, 0, editButton.width, editButton.height, I18n.format("gui.cancel"));
    }
    cancelButton.x = editButton.x;
    cancelButton.y = editButton.y;
    cancelButton.visible = editMode;
    if (removeButton == null) {
        removeButton = new GuiButtonExt(4, 0, 0, doneButton.width, doneButton.height, I18n.format("gui.remove"));
    }
    removeButton.x = editButton.x - editButton.width - 3;
    removeButton.y = doneButton.y;
    removeButton.visible = !editMode;
    if (addButton == null) {
        addButton = new GuiButtonExt(3, 0, 0, doneButton.width, doneButton.height, I18n.format("gui.add"));
    }
    addButton.x = removeButton.x - removeButton.width - 3;
    addButton.y = doneButton.y;
    addButton.visible = !editMode;
    if (clearButton == null) {
        clearButton = new GuiButtonExt(5, 0, 0, removeButton.width, removeButton.height, I18n.format("gui.clear"));
    }
    clearButton.x = removeButton.x;
    clearButton.y = removeButton.y;
    clearButton.visible = false;
    if (detailInfo == null) {
        detailInfo = new GuiCheckBox(6, 0, 5, I18n.format(Config.LANG_KEY + "detail"), true);
    }
    detailInfo.setIsChecked(CaveConfigGui.detailInfo);
    detailInfo.x = width / 2 + 95;
    if (instantFilter == null) {
        instantFilter = new GuiCheckBox(7, 0, detailInfo.y + detailInfo.height + 2, I18n.format(Config.LANG_KEY + "instant"), true);
    }
    instantFilter.setIsChecked(CaveConfigGui.instantFilter);
    instantFilter.x = detailInfo.x;
    buttonList.clear();
    buttonList.add(doneButton);
    if (editMode) {
        buttonList.add(cancelButton);
    } else {
        buttonList.add(editButton);
        buttonList.add(addButton);
        buttonList.add(removeButton);
        buttonList.add(clearButton);
    }
    buttonList.add(detailInfo);
    buttonList.add(instantFilter);
    if (filterTextField == null) {
        filterTextField = new GuiTextField(0, fontRenderer, 0, 0, 122, 16);
        filterTextField.setMaxStringLength(500);
    }
    filterTextField.x = width / 2 - 200;
    filterTextField.y = height - filterTextField.height - 6;
    detailHoverChecker = new HoverChecker(detailInfo, 800);
    instantHoverChecker = new HoverChecker(instantFilter, 800);
    editLabelList.clear();
    editLabelList.add(I18n.format(Config.LANG_KEY + "veins.block"));
    editLabelList.add("");
    editLabelList.add(I18n.format(Config.LANG_KEY + "veins.targetBlock"));
    editLabelList.add("");
    editLabelList.add(I18n.format(Config.LANG_KEY + "veins.weight"));
    editLabelList.add(I18n.format(Config.LANG_KEY + "veins.chance"));
    editLabelList.add(I18n.format(Config.LANG_KEY + "veins.size"));
    editLabelList.add(I18n.format(Config.LANG_KEY + "veins.height"));
    editLabelList.add("");
    editLabelList.add(I18n.format(Config.LANG_KEY + "veins.biomes"));
    for (String key : editLabelList) {
        maxLabelWidth = Math.max(maxLabelWidth, fontRenderer.getStringWidth(key));
    }
    if (blockField == null) {
        blockField = new GuiTextField(1, fontRenderer, 0, 0, 0, 15);
        blockField.setMaxStringLength(100);
    }
    int i = maxLabelWidth + 8 + width / 2;
    blockField.x = width / 2 - i / 2 + maxLabelWidth + 10;
    blockField.y = veinList.bottom + 5;
    int fieldWidth = width / 2 + i / 2 - 45 - blockField.x + 40;
    blockField.width = fieldWidth / 4 + fieldWidth / 2 - 1;
    if (blockMetaField == null) {
        blockMetaField = new GuiTextField(2, fontRenderer, 0, 0, 0, blockField.height);
        blockMetaField.setMaxStringLength(100);
    }
    blockMetaField.x = blockField.x + blockField.width + 3;
    blockMetaField.y = blockField.y;
    blockMetaField.width = fieldWidth / 4 - 1;
    if (targetField == null) {
        targetField = new GuiTextField(3, fontRenderer, 0, 0, 0, blockField.height);
        targetField.setMaxStringLength(100);
    }
    targetField.x = blockField.x;
    targetField.y = blockField.y + blockField.height + 5;
    targetField.width = blockField.width;
    if (targetMetaField == null) {
        targetMetaField = new GuiTextField(4, fontRenderer, 0, 0, 0, blockField.height);
        targetMetaField.setMaxStringLength(100);
    }
    targetMetaField.x = targetField.x + targetField.width + 3;
    targetMetaField.y = targetField.y;
    targetMetaField.width = blockMetaField.width;
    if (weightField == null) {
        weightField = new GuiTextField(5, fontRenderer, 0, 0, 0, blockField.height);
        weightField.setMaxStringLength(3);
    }
    weightField.x = targetField.x;
    weightField.y = targetField.y + targetField.height + 5;
    weightField.width = fieldWidth;
    if (chanceField == null) {
        chanceField = new GuiTextField(6, fontRenderer, 0, 0, 0, blockField.height);
        chanceField.setMaxStringLength(3);
    }
    chanceField.x = weightField.x;
    chanceField.y = weightField.y + weightField.height + 5;
    chanceField.width = weightField.width;
    if (sizeField == null) {
        sizeField = new GuiTextField(7, fontRenderer, 0, 0, 0, blockField.height);
        sizeField.setMaxStringLength(3);
    }
    sizeField.x = chanceField.x;
    sizeField.y = chanceField.y + chanceField.height + 5;
    sizeField.width = chanceField.width;
    if (minHeightField == null) {
        minHeightField = new GuiTextField(8, fontRenderer, 0, 0, 0, blockField.height);
        minHeightField.setMaxStringLength(3);
    }
    minHeightField.x = sizeField.x;
    minHeightField.y = sizeField.y + sizeField.height + 5;
    minHeightField.width = fieldWidth / 2 - 1;
    if (maxHeightField == null) {
        maxHeightField = new GuiTextField(9, fontRenderer, 0, 0, 0, blockField.height);
        maxHeightField.setMaxStringLength(3);
    }
    maxHeightField.x = minHeightField.x + minHeightField.width + 3;
    maxHeightField.y = minHeightField.y;
    maxHeightField.width = minHeightField.width;
    if (biomesField == null) {
        biomesField = new GuiTextField(10, fontRenderer, 0, 0, 0, blockField.height);
        biomesField.setMaxStringLength(800);
    }
    biomesField.x = minHeightField.x;
    biomesField.y = minHeightField.y + minHeightField.height + 5;
    biomesField.width = sizeField.width;
    editFieldList.clear();
    if (editMode) {
        editFieldList.add(blockField);
        editFieldList.add(blockMetaField);
        editFieldList.add(targetField);
        editFieldList.add(targetMetaField);
        editFieldList.add(weightField);
        editFieldList.add(chanceField);
        editFieldList.add(sizeField);
        editFieldList.add(minHeightField);
        editFieldList.add(maxHeightField);
        editFieldList.add(biomesField);
    }
    blockHoverChecker = new HoverChecker(blockField.y - 1, blockField.y + blockField.height, blockField.x - maxLabelWidth - 12, blockField.x - 10, 800);
    targetHoverChecker = new HoverChecker(targetField.y - 1, targetField.y + targetField.height, targetField.x - maxLabelWidth - 12, targetField.x - 10, 800);
    weightHoverChecker = new HoverChecker(weightField.y - 1, weightField.y + weightField.height, weightField.x - maxLabelWidth - 12, weightField.x - 10, 800);
    chanceHoverChecker = new HoverChecker(chanceField.y - 1, chanceField.y + chanceField.height, chanceField.x - maxLabelWidth - 12, chanceField.x - 10, 800);
    sizeHoverChecker = new HoverChecker(sizeField.y - 1, sizeField.y + sizeField.height, sizeField.x - maxLabelWidth - 12, sizeField.x - 10, 800);
    heightHoverChecker = new HoverChecker(minHeightField.y - 1, minHeightField.y + minHeightField.height, minHeightField.x - maxLabelWidth - 12, minHeightField.x - 10, 800);
    biomesHoverChecker = new HoverChecker(biomesField.y - 1, biomesField.y + biomesField.height, biomesField.x - maxLabelWidth - 12, biomesField.x - 10, 800);
}
Also used : GuiButtonExt(net.minecraftforge.fml.client.config.GuiButtonExt) GuiCheckBox(net.minecraftforge.fml.client.config.GuiCheckBox) GuiTextField(net.minecraft.client.gui.GuiTextField) HoverChecker(net.minecraftforge.fml.client.config.HoverChecker)

Example 22 with GuiButtonExt

use of net.minecraftforge.fml.client.config.GuiButtonExt in project Cavern2 by kegare.

the class GuiMiningPointsEditor method initGui.

@Override
public void initGui() {
    if (pointList == null) {
        pointList = new PointList();
    }
    pointList.setDimensions(width, height, 32, height - (editMode ? 52 : 28));
    if (doneButton == null) {
        doneButton = new GuiButtonExt(0, 0, 0, 65, 20, I18n.format("gui.done"));
    }
    doneButton.x = width / 2 + 135;
    doneButton.y = height - doneButton.height - 4;
    if (editButton == null) {
        editButton = new GuiButtonExt(1, 0, 0, doneButton.width, doneButton.height, I18n.format("gui.edit"));
        editButton.enabled = false;
    }
    editButton.x = doneButton.x - doneButton.width - 3;
    editButton.y = doneButton.y;
    editButton.enabled = pointList.selected != null;
    editButton.visible = !editMode;
    if (cancelButton == null) {
        cancelButton = new GuiButtonExt(2, 0, 0, editButton.width, editButton.height, I18n.format("gui.cancel"));
    }
    cancelButton.x = editButton.x;
    cancelButton.y = editButton.y;
    cancelButton.visible = editMode;
    if (removeButton == null) {
        removeButton = new GuiButtonExt(4, 0, 0, doneButton.width, doneButton.height, I18n.format("gui.remove"));
    }
    removeButton.x = editButton.x - editButton.width - 3;
    removeButton.y = doneButton.y;
    removeButton.visible = !editMode;
    if (addButton == null) {
        addButton = new GuiButtonExt(3, 0, 0, doneButton.width, doneButton.height, I18n.format("gui.add"));
    }
    addButton.x = removeButton.x - removeButton.width - 3;
    addButton.y = doneButton.y;
    addButton.visible = !editMode;
    if (clearButton == null) {
        clearButton = new GuiButtonExt(5, 0, 0, removeButton.width, removeButton.height, I18n.format("gui.clear"));
    }
    clearButton.x = removeButton.x;
    clearButton.y = removeButton.y;
    clearButton.visible = false;
    if (detailInfo == null) {
        detailInfo = new GuiCheckBox(6, 0, 5, I18n.format(Config.LANG_KEY + "detail"), true);
    }
    detailInfo.setIsChecked(CaveConfigGui.detailInfo);
    detailInfo.x = width / 2 + 95;
    if (instantFilter == null) {
        instantFilter = new GuiCheckBox(7, 0, detailInfo.y + detailInfo.height + 2, I18n.format(Config.LANG_KEY + "instant"), true);
    }
    instantFilter.setIsChecked(CaveConfigGui.instantFilter);
    instantFilter.x = detailInfo.x;
    buttonList.clear();
    buttonList.add(doneButton);
    if (editMode) {
        buttonList.add(cancelButton);
    } else {
        buttonList.add(editButton);
        buttonList.add(addButton);
        buttonList.add(removeButton);
        buttonList.add(clearButton);
    }
    buttonList.add(detailInfo);
    buttonList.add(instantFilter);
    if (filterTextField == null) {
        filterTextField = new GuiTextField(0, fontRenderer, 0, 0, 122, 16);
        filterTextField.setMaxStringLength(500);
    }
    filterTextField.x = width / 2 - 200;
    filterTextField.y = height - filterTextField.height - 6;
    detailHoverChecker = new HoverChecker(detailInfo, 800);
    instantHoverChecker = new HoverChecker(instantFilter, 800);
    editLabelList.clear();
    editLabelList.add(I18n.format(Config.LANG_KEY + "points.point"));
    for (String key : editLabelList) {
        maxLabelWidth = Math.max(maxLabelWidth, fontRenderer.getStringWidth(key));
    }
    if (pointField == null) {
        pointField = new GuiTextField(5, fontRenderer, 0, 0, 0, 15);
        pointField.setMaxStringLength(5);
    }
    int i = maxLabelWidth + 8 + width / 2;
    pointField.x = width / 2 - i / 2 + maxLabelWidth + 10;
    pointField.y = pointList.bottom + 7;
    int fieldWidth = width / 2 + i / 2 - 45 - pointField.x + 40;
    pointField.width = fieldWidth / 4 + fieldWidth / 2 - 1;
    editFieldList.clear();
    if (editMode) {
        editFieldList.add(pointField);
    }
    pointHoverChecker = new HoverChecker(pointField.y - 1, pointField.y + pointField.height, pointField.x - maxLabelWidth - 12, pointField.x - 10, 800);
}
Also used : GuiButtonExt(net.minecraftforge.fml.client.config.GuiButtonExt) GuiCheckBox(net.minecraftforge.fml.client.config.GuiCheckBox) GuiTextField(net.minecraft.client.gui.GuiTextField) HoverChecker(net.minecraftforge.fml.client.config.HoverChecker)

Example 23 with GuiButtonExt

use of net.minecraftforge.fml.client.config.GuiButtonExt in project ConvenientAdditions by Necr0.

the class GuiProximitySensor method initGui.

@Override
public void initGui() {
    super.initGui();
    range = addWidget(new Slider(leftX + 9, topY + 9, 120, 16, .5d, 15d, te.range, .5d).setPrefix(Helper.localize(ModConstants.Mod.MODID + ":range") + ": ").setSuffix(" " + Helper.localize(ModConstants.Mod.MODID + ":unit.blocks")));
    addButton(new GuiButtonExt(0, leftX + 129, topY + 9, 30, 15, Helper.localize(ModConstants.Mod.MODID + ":done")));
}
Also used : Slider(convenientadditions.api.gui.widget.Slider) GuiButtonExt(net.minecraftforge.fml.client.config.GuiButtonExt)

Example 24 with GuiButtonExt

use of net.minecraftforge.fml.client.config.GuiButtonExt in project ConvenientAdditions by Necr0.

the class GuiTransmutationTomeRecipeLookup method initGui.

@Override
public void initGui() {
    super.initGui();
    initClearable();
    addWidget(new Label(leftX + 8, topY + 6, Helper.localize("gui." + ModConstants.Mod.MODID + ":transmutationTomeLookup")));
    addButton(new GuiButtonExt(0, leftX + 8, topY + 108, 12, 12, "<"));
    addButton(new GuiButtonExt(1, leftX + 156, topY + 108, 12, 12, ">"));
    textBox = addWidget(new TextBox(2, leftX + 73, topY + 5, 98, 10));
    textBox.setText(query);
}
Also used : CenteredLabel(convenientadditions.api.gui.widget.label.CenteredLabel) Label(convenientadditions.api.gui.widget.label.Label) GuiButtonExt(net.minecraftforge.fml.client.config.GuiButtonExt) TextBox(convenientadditions.api.gui.widget.TextBox)

Example 25 with GuiButtonExt

use of net.minecraftforge.fml.client.config.GuiButtonExt in project MC-Prefab by Brian-Wuest.

the class GuiChickenCoop method Initialize.

@Override
protected void Initialize() {
    this.configuration = ClientEventHandler.playerConfig.getClientConfig("Chicken Coop", ChickenCoopConfiguration.class);
    this.configuration.pos = this.pos;
    // Get the upper left hand corner of the GUI box.
    int grayBoxX = this.getCenteredXAxis() - 213;
    int grayBoxY = this.getCenteredYAxis() - 83;
    // Create the buttons.
    this.btnVisualize = new GuiButtonExt(4, grayBoxX + 10, grayBoxY + 90, 90, 20, GuiLangKeys.translateString(GuiLangKeys.GUI_BUTTON_PREVIEW));
    this.buttonList.add(this.btnVisualize);
    // Create the done and cancel buttons.
    this.btnBuild = new GuiButtonExt(1, grayBoxX + 10, grayBoxY + 136, 90, 20, GuiLangKeys.translateString(GuiLangKeys.GUI_BUTTON_BUILD));
    this.buttonList.add(this.btnBuild);
    this.btnCancel = new GuiButtonExt(2, grayBoxX + 147, grayBoxY + 136, 90, 20, GuiLangKeys.translateString(GuiLangKeys.GUI_BUTTON_CANCEL));
    this.buttonList.add(this.btnCancel);
}
Also used : GuiButtonExt(net.minecraftforge.fml.client.config.GuiButtonExt) ChickenCoopConfiguration(com.wuest.prefab.Config.Structures.ChickenCoopConfiguration)

Aggregations

GuiButtonExt (net.minecraftforge.fml.client.config.GuiButtonExt)46 HoverChecker (net.minecraftforge.fml.client.config.HoverChecker)11 GuiCheckBox (net.minecraftforge.fml.client.config.GuiCheckBox)10 GuiTextField (net.minecraft.client.gui.GuiTextField)9 GuiButton (net.minecraft.client.gui.GuiButton)4 GuiTooltip (org.blockartistry.lib.gui.GuiTooltip)4 GuiCheckBox (com.wuest.prefab.Gui.Controls.GuiCheckBox)3 GuiTab (com.wuest.prefab.Gui.Controls.GuiTab)2 GuiLabel (net.minecraft.client.gui.GuiLabel)2 GuiSlider (net.minecraftforge.fml.client.config.GuiSlider)2 IStructureConfigurationCapability (com.wuest.prefab.Capabilities.IStructureConfigurationCapability)1 BasicStructureConfiguration (com.wuest.prefab.Config.Structures.BasicStructureConfiguration)1 BulldozerConfiguration (com.wuest.prefab.Config.Structures.BulldozerConfiguration)1 ChickenCoopConfiguration (com.wuest.prefab.Config.Structures.ChickenCoopConfiguration)1 FishPondConfiguration (com.wuest.prefab.Config.Structures.FishPondConfiguration)1 HorseStableConfiguration (com.wuest.prefab.Config.Structures.HorseStableConfiguration)1 InstantBridgeConfiguration (com.wuest.prefab.Config.Structures.InstantBridgeConfiguration)1 ModerateHouseConfiguration (com.wuest.prefab.Config.Structures.ModerateHouseConfiguration)1 ModularHouseConfiguration (com.wuest.prefab.Config.Structures.ModularHouseConfiguration)1 MonsterMasherConfiguration (com.wuest.prefab.Config.Structures.MonsterMasherConfiguration)1