Search in sources :

Example 1 with GuiStringList

use of lumien.randomthings.client.gui.elements.GuiStringList 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)

Aggregations

GuiCustomButton (lumien.randomthings.client.gui.elements.GuiCustomButton)1 GuiStringList (lumien.randomthings.client.gui.elements.GuiStringList)1 MessageVoxelProjector (lumien.randomthings.network.messages.MessageVoxelProjector)1 GuiSlider (net.minecraftforge.fml.client.config.GuiSlider)1