Search in sources :

Example 1 with GuiSlider

use of net.minecraftforge.fml.client.config.GuiSlider in project Random-Things by lumien231.

the class GuiVoxelProjector method initGui.

@Override
public void initGui() {
    super.initGui();
    this.buttonList.add(new GuiSlider(0, this.guiLeft + 5, this.guiTop + 90, 120, 20, "Model Rotation: ", "", 0, 360, this.te.getModelRotation(), false, true, new GuiSlider.ISlider() {

        @Override
        public void onChangeSliderValue(GuiSlider slider) {
            int rotation = slider.getValueInt();
            GuiVoxelProjector.this.te.setModelRotation(rotation);
            if (rotation != GuiVoxelProjector.this.oldRotation) {
                GuiVoxelProjector.this.oldRotation = (int) Math.floor(slider.sliderValue * 360);
                MessageVoxelProjector message = new MessageVoxelProjector(GuiVoxelProjector.this.te.getPos());
                message.setModelRotation(rotation);
                PacketHandler.INSTANCE.sendToServer(message);
            }
        }
    }));
    this.buttonList.add(new GuiSlider(1, this.guiLeft + 5, this.guiTop + 60, 120, 20, "Scale: ", "", 1, 20, this.te.getScale(), false, true, new GuiSlider.ISlider() {

        @Override
        public void onChangeSliderValue(GuiSlider slider) {
            int scale = slider.getValueInt();
            GuiVoxelProjector.this.te.setScale(scale);
            if (scale != GuiVoxelProjector.this.oldScale) {
                GuiVoxelProjector.this.oldScale = scale;
                MessageVoxelProjector message = new MessageVoxelProjector(GuiVoxelProjector.this.te.getPos());
                message.setScale(scale);
                PacketHandler.INSTANCE.sendToServer(message);
            }
        }
    }));
    this.buttonList.add(new GuiSlider(2, this.guiLeft + 5, this.guiTop + 120, 120, 20, "Rotation Speed: ", "", 0, 40, this.te.getRotationSpeed(), false, true, new GuiSlider.ISlider() {

        @Override
        public void onChangeSliderValue(GuiSlider slider) {
            int rotationSpeed = slider.getValueInt();
            GuiVoxelProjector.this.te.setRotationSpeed(rotationSpeed);
            if (rotationSpeed != GuiVoxelProjector.this.oldRotationSpeed) {
                GuiVoxelProjector.this.oldRotationSpeed = rotationSpeed;
                MessageVoxelProjector message = new MessageVoxelProjector(GuiVoxelProjector.this.te.getPos());
                message.setRotationSpeed(rotationSpeed);
                PacketHandler.INSTANCE.sendToServer(message);
            }
        }
    }));
    toggleAmbientLight = new GuiCustomButton(this, 3, te.ambientLight(), this.guiLeft + xSize - 25, this.guiTop + 60, 20, 20, "", buttons, 0, 0);
    toggleRandomizer = new GuiCustomButton(this, 4, te.randomize(), this.guiLeft + xSize - 25, this.guiTop + 85, 20, 20, "", buttons, 42, 0);
    this.buttonList.add(toggleAmbientLight);
    this.buttonList.add(toggleRandomizer);
    availableModels = new GuiStringList(this, Minecraft.getMinecraft(), 120, 50, this.guiLeft + 5, this.guiTop + 150, width, height, Lists.<String>newArrayList());
}
Also used : GuiCustomButton(lumien.randomthings.client.gui.elements.GuiCustomButton) GuiStringList(lumien.randomthings.client.gui.elements.GuiStringList) MessageVoxelProjector(lumien.randomthings.network.messages.MessageVoxelProjector) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider)

Example 2 with GuiSlider

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

the class GuiStartHouseChooser method Initialize.

private void Initialize() {
    // Get the upper left hand corner of the GUI box.
    int grayBoxX = (this.width / 2) - 188;
    int grayBoxY = (this.height / 2) - 83;
    int color = Color.DARK_GRAY.getRGB();
    this.serverConfiguration = ((ClientProxy) Prefab.proxy).getServerConfiguration();
    // Create the Controls.
    // Column 1:
    this.btnHouseStyle = new GuiButtonExt(4, grayBoxX + 10, grayBoxY + 20, 90, 20, this.houseConfiguration.houseStyle.getDisplayName());
    this.buttonList.add(this.btnHouseStyle);
    this.btnVisualize = new GuiButtonExt(4, grayBoxX + 10, grayBoxY + 60, 90, 20, GuiLangKeys.translateString(GuiLangKeys.GUI_BUTTON_PREVIEW));
    this.buttonList.add(this.btnVisualize);
    int x = grayBoxX + 10;
    int y = grayBoxY + 10;
    int secondColumnY = y;
    int secondColumnX = x + 137;
    this.btnAddFurnace = new GuiCheckBox(5, secondColumnX, secondColumnY, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_FURNACE), this.houseConfiguration.addFurnace);
    this.btnAddFurnace.setStringColor(color);
    this.btnAddFurnace.setWithShadow(false);
    this.btnAddFurnace.visible = false;
    this.buttonList.add(this.btnAddFurnace);
    if (this.serverConfiguration.addFurnace) {
        secondColumnY += 15;
    }
    this.btnAddBed = new GuiCheckBox(2, secondColumnX, secondColumnY, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_BED), this.houseConfiguration.addBed);
    this.btnAddBed.setStringColor(color);
    this.btnAddBed.setWithShadow(false);
    this.btnAddBed.visible = false;
    this.buttonList.add(this.btnAddBed);
    if (this.serverConfiguration.addBed) {
        secondColumnY += 15;
    }
    this.btnAddFarm = new GuiCheckBox(6, secondColumnX, secondColumnY, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_FARM), this.houseConfiguration.addFarm);
    this.btnAddFarm.setStringColor(color);
    this.btnAddFarm.setWithShadow(false);
    this.btnAddFarm.visible = false;
    this.buttonList.add(this.btnAddFarm);
    if (this.serverConfiguration.addFarm) {
        secondColumnY += 15;
    }
    this.btnAddCraftingTable = new GuiCheckBox(5, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_CRAFTING_TABLE), this.houseConfiguration.addCraftingTable);
    this.btnAddCraftingTable.setStringColor(color);
    this.btnAddCraftingTable.setWithShadow(false);
    this.btnAddCraftingTable.visible = false;
    this.buttonList.add(this.btnAddCraftingTable);
    if (this.serverConfiguration.addCraftingTable) {
        y += 15;
    }
    this.btnAddTorches = new GuiCheckBox(1, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_TORCHES), this.houseConfiguration.addTorches);
    this.btnAddTorches.setStringColor(color);
    this.btnAddTorches.setWithShadow(false);
    this.btnAddTorches.visible = false;
    this.buttonList.add(this.btnAddTorches);
    if (this.serverConfiguration.addTorches) {
        y += 15;
    }
    this.btnAddChest = new GuiCheckBox(3, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_CHEST), this.houseConfiguration.addChest);
    this.btnAddChest.setStringColor(color);
    this.btnAddChest.setWithShadow(false);
    this.btnAddChest.visible = false;
    this.buttonList.add(this.btnAddChest);
    if (this.serverConfiguration.addChests) {
        y += 15;
    }
    this.btnAddMineShaft = new GuiCheckBox(7, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_BUILD_MINESHAFT), this.houseConfiguration.addMineShaft);
    this.btnAddMineShaft.setStringColor(color);
    this.btnAddMineShaft.setWithShadow(false);
    this.btnAddMineShaft.visible = false;
    this.buttonList.add(this.btnAddMineShaft);
    if (this.serverConfiguration.addMineshaft) {
        y += 15;
    }
    this.btnAddChestContents = new GuiCheckBox(4, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_CHEST_CONTENTS), this.houseConfiguration.addChestContents);
    this.btnAddChestContents.setStringColor(color);
    this.btnAddChestContents.setWithShadow(false);
    this.btnAddChestContents.visible = false;
    this.buttonList.add(this.btnAddChestContents);
    if (this.allowItemsInChestAndFurnace) {
        y += 15;
    }
    this.btnIsCeilingFlat = new GuiCheckBox(8, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_CEILING_FLAT), this.houseConfiguration.isCeilingFlat);
    this.btnIsCeilingFlat.setStringColor(color);
    this.btnIsCeilingFlat.setWithShadow(false);
    this.btnIsCeilingFlat.visible = false;
    this.buttonList.add(this.btnIsCeilingFlat);
    this.btnFloorBlock = new GuiTextSlider(11, grayBoxX + 10, grayBoxY + 20, 90, 20, 0, 2, this.houseConfiguration.floorBlock.getValue(), GuiLangKeys.STARTER_HOUSE_FLOOR_STONE);
    this.buttonList.add(this.btnFloorBlock);
    this.btnCeilingBlock = new GuiTextSlider(12, grayBoxX + 10, grayBoxY + 60, 90, 20, 0, 2, this.houseConfiguration.ceilingBlock.getValue(), GuiLangKeys.STARTER_HOUSE_CEILING_TYPE);
    this.buttonList.add(this.btnCeilingBlock);
    this.btnWallWoodType = new GuiTextSlider(13, grayBoxX + 10, grayBoxY + 100, 90, 20, 0, 5, this.houseConfiguration.wallWoodType.getValue(), GuiLangKeys.STARTER_HOUSE_WALL_TYPE);
    this.buttonList.add(this.btnWallWoodType);
    this.btnGlassColor = new GuiButtonExt(17, grayBoxX + 10, grayBoxY + 20, 90, 20, GuiLangKeys.translateDye(this.houseConfiguration.glassColor));
    this.buttonList.add(this.btnGlassColor);
    // Column 2:
    // Column 3:
    this.btnHouseDepth = new GuiSlider(15, grayBoxX + 147, grayBoxY + 20, 90, 20, "", "", 5, serverConfiguration.maximumStartingHouseSize, this.houseConfiguration.houseDepth, false, true);
    this.buttonList.add(this.btnHouseDepth);
    this.btnHouseWidth = new GuiSlider(16, grayBoxX + 147, grayBoxY + 60, 90, 20, "", "", 5, serverConfiguration.maximumStartingHouseSize, this.houseConfiguration.houseWidth, false, true);
    this.buttonList.add(this.btnHouseWidth);
    // Tabs:
    this.tabGeneral = new GuiTab(this.Tabs, GuiLangKeys.translateString(GuiLangKeys.STARTER_TAB_GENERAL), grayBoxX + 3, grayBoxY - 20);
    this.Tabs.AddTab(this.tabGeneral);
    this.tabConfig = new GuiTab(this.Tabs, GuiLangKeys.translateString(GuiLangKeys.STARTER_TAB_CONFIG), grayBoxX + 54, grayBoxY - 20);
    this.Tabs.AddTab(this.tabConfig);
    this.tabBlockTypes = new GuiTab(this.Tabs, GuiLangKeys.translateString(GuiLangKeys.STARTER_TAB_BLOCK), grayBoxX + 105, grayBoxY - 20);
    this.tabBlockTypes.width = 70;
    this.Tabs.AddTab(this.tabBlockTypes);
    // 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 : GuiTab(com.wuest.prefab.Gui.Controls.GuiTab) GuiButtonExt(net.minecraftforge.fml.client.config.GuiButtonExt) GuiCheckBox(com.wuest.prefab.Gui.Controls.GuiCheckBox) GuiTextSlider(com.wuest.prefab.Gui.Controls.GuiTextSlider) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider)

Example 3 with GuiSlider

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

the class GuiInstantBridge method Initialize.

@Override
protected void Initialize() {
    this.configuration = ClientEventHandler.playerConfig.getClientConfig("InstantBridge", InstantBridgeConfiguration.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.btnMaterialType = new GuiButtonExt(3, grayBoxX + 10, grayBoxY + 20, 90, 20, this.configuration.bridgeMaterial.getTranslatedName());
    this.buttonList.add(this.btnMaterialType);
    this.sldrBridgeLength = new GuiSlider(5, grayBoxX + 147, grayBoxY + 20, 90, 20, "", "", 25, 75, this.configuration.bridgeLength, false, true);
    this.buttonList.add(this.sldrBridgeLength);
    this.chckIncludeRoof = new GuiCheckBox(6, grayBoxX + 147, grayBoxY + 55, GuiLangKeys.translateString(GuiLangKeys.INCLUDE_ROOF), this.configuration.includeRoof);
    this.buttonList.add(this.chckIncludeRoof);
    this.sldrInteriorHeight = new GuiSlider(7, grayBoxX + 147, grayBoxY + 90, 90, 20, "", "", 3, 8, this.configuration.interiorHeight, false, true);
    this.buttonList.add(this.sldrInteriorHeight);
    this.sldrInteriorHeight.enabled = this.chckIncludeRoof.isChecked();
    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) InstantBridgeConfiguration(com.wuest.prefab.Config.Structures.InstantBridgeConfiguration) GuiCheckBox(com.wuest.prefab.Gui.Controls.GuiCheckBox) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider)

Example 4 with GuiSlider

use of net.minecraftforge.fml.client.config.GuiSlider in project Hyperium by HyperiumClient.

the class GuiScreenBackgroundColor method initGui.

@Override
public void initGui() {
    buttonList.add(new GuiSlider(0, width / 2 - 80, calculateHeight(3), 150, 20, "Red: ", "", 0, 255, red.getAmount(), false, true) {

        @Override
        public void updateSlider() {
            super.updateSlider();
            red.onScroll(getValue(), getValueInt());
            updated = true;
        }
    });
    buttonList.add(new GuiSlider(1, width / 2 - 80, calculateHeight(4), 150, 20, "Green: ", "", 0, 255, green.getAmount(), false, true) {

        @Override
        public void updateSlider() {
            super.updateSlider();
            green.onScroll(getValue(), getValueInt());
            updated = true;
        }
    });
    buttonList.add(new GuiSlider(2, width / 2 - 80, calculateHeight(5), 150, 20, "Blue: ", "", 0, 255, blue.getAmount(), false, true) {

        @Override
        public void updateSlider() {
            super.updateSlider();
            blue.onScroll(getValue(), getValueInt());
            updated = true;
        }
    });
    buttonList.add(new GuiButton(3, 5, height - 25, 100, 20, "Back"));
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider)

Example 5 with GuiSlider

use of net.minecraftforge.fml.client.config.GuiSlider in project Hyperium by HyperiumClient.

the class GuiScreenSettings method initGui.

public void initGui() {
    buttonList.add(new GuiButton(0, getCenter() - 75, getRowPos(1), 150, 20, "Sidebar: " + getSuffix(sidebar.enabled)));
    buttonList.add(new GuiButton(1, getCenter() - 75, getRowPos(2), 150, 20, "Red Numbers: " + getSuffix(sidebar.redNumbers)));
    buttonList.add(new GuiButton(2, getCenter() - 75, getRowPos(3), 150, 20, "Shadow: " + getSuffix(sidebar.shadow)));
    buttonList.add(new GuiButton(3, getCenter() - 75, getRowPos(4), 150, 20, "Change Background"));
    buttonList.add(sliderScale = new GuiSlider(4, getCenter() - 75, getRowPos(5), 150, 20, "Scale: ", "%", 50.0, 200.0, Math.round(sidebar.scale * 100.0f), false, true));
    buttonList.add(new GuiButton(5, getCenter() - 75, getRowPos(6), 150, 20, "Reset Sidebar"));
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider)

Aggregations

GuiSlider (net.minecraftforge.fml.client.config.GuiSlider)9 GuiButton (net.minecraft.client.gui.GuiButton)5 GuiCheckBox (com.wuest.prefab.Gui.Controls.GuiCheckBox)2 GuiButtonExt (net.minecraftforge.fml.client.config.GuiButtonExt)2 Hyperium (cc.hyperium.Hyperium)1 Levelhead (cc.hyperium.mods.levelhead.Levelhead)1 cc.hyperium.mods.levelhead.display (cc.hyperium.mods.levelhead.display)1 LevelheadPurchaseStates (cc.hyperium.mods.levelhead.purchases.LevelheadPurchaseStates)1 LevelheadChatRenderer (cc.hyperium.mods.levelhead.renderer.LevelheadChatRenderer)1 LevelheadJsonHolder (cc.hyperium.mods.levelhead.util.LevelheadJsonHolder)1 Multithreading (cc.hyperium.mods.sk1ercommon.Multithreading)1 Sk1erMod (cc.hyperium.mods.sk1ercommon.Sk1erMod)1 ChatColor (cc.hyperium.utils.ChatColor)1 JsonHolder (cc.hyperium.utils.JsonHolder)1 InstantBridgeConfiguration (com.wuest.prefab.Config.Structures.InstantBridgeConfiguration)1 GuiTab (com.wuest.prefab.Gui.Controls.GuiTab)1 GuiTextSlider (com.wuest.prefab.Gui.Controls.GuiTextSlider)1 java.awt (java.awt)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1