]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Add GUI to configuration support
authorIrtimaled <irtimaled@gmail.com>
Sun, 3 Mar 2019 07:59:32 +0000 (23:59 -0800)
committerIrtimaled <irtimaled@gmail.com>
Sun, 10 Mar 2019 01:43:25 +0000 (17:43 -0800)
15 files changed:
src/main/java/com/irtimaled/bbor/client/gui/BoolSettingButton.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/gui/BoundingBoxTypeButton.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/gui/Button.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/gui/CreateControl.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/gui/IControl.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/gui/IRenderableControl.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/gui/IRowHeight.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/gui/IntSettingSlider.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/gui/MaxYSettingSlider.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/gui/SettingsScreen.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/gui/SettingsScreenButton.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/renderers/VillageRenderer.java
src/main/java/com/irtimaled/bbor/common/BoundingBoxType.java
src/main/java/com/irtimaled/bbor/mixin/client/gui/MixinGuiOptions.java [new file with mode: 0644]
src/main/resources/mixins.bbor.json

diff --git a/src/main/java/com/irtimaled/bbor/client/gui/BoolSettingButton.java b/src/main/java/com/irtimaled/bbor/client/gui/BoolSettingButton.java
new file mode 100644 (file)
index 0000000..d0850ef
--- /dev/null
@@ -0,0 +1,22 @@
+package com.irtimaled.bbor.client.gui;
+
+import com.irtimaled.bbor.config.Setting;
+
+public class BoolSettingButton extends Button {
+    private final Setting<Boolean> setting;
+
+    BoolSettingButton(int id, int x, int y, int width, String label, Setting<Boolean> setting) {
+        super(id, x, y, width, label);
+        this.setting = setting;
+    }
+
+    @Override
+    protected int getHoverState(boolean p_getHoverState_1_) {
+        return setting.get() ? 2 : 1;
+    }
+
+    @Override
+    public void onClick(double p_onClick_1_, double p_onClick_3_) {
+        setting.set(!setting.get());
+    }
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/gui/BoundingBoxTypeButton.java b/src/main/java/com/irtimaled/bbor/client/gui/BoundingBoxTypeButton.java
new file mode 100644 (file)
index 0000000..496629d
--- /dev/null
@@ -0,0 +1,37 @@
+package com.irtimaled.bbor.client.gui;
+
+import com.irtimaled.bbor.common.BoundingBoxType;
+import net.minecraft.client.Minecraft;
+
+import java.awt.*;
+
+public class BoundingBoxTypeButton extends BoolSettingButton {
+    private final Color color;
+
+    BoundingBoxTypeButton(int id, int x, int y, int width, String label, BoundingBoxType type) {
+        super(id, x, y, width, label, type.shouldRenderSetting);
+        color = type.getColor();
+    }
+
+    @Override
+    protected void renderBg(Minecraft p_renderBg_1_, int p_renderBg_2_, int p_renderBg_3_) {
+        int left = x + 1;
+        int top = y + 1;
+        int right = left + width - 2;
+        int bottom = top + height - 2;
+
+        // top & left
+        drawRect(left, top, right, top + 1, color.getRGB());
+        drawRect(left, top, left + 1, bottom, color.getRGB());
+
+        Color darker = color.darker();
+        // bottom left & top right
+        drawRect(left, bottom - 2, left + 1, bottom, darker.getRGB());
+        drawRect(right - 1, top, right, top + 1, darker.getRGB());
+
+        Color darkest = darker.darker();
+        // bottom & right
+        drawRect(left + 1, bottom - 2, right, bottom, darkest.getRGB());
+        drawRect(right - 1, top + 1, right, bottom, darkest.getRGB());
+    }
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/gui/Button.java b/src/main/java/com/irtimaled/bbor/client/gui/Button.java
new file mode 100644 (file)
index 0000000..2e76b65
--- /dev/null
@@ -0,0 +1,19 @@
+package com.irtimaled.bbor.client.gui;
+
+import net.minecraft.client.gui.GuiButton;
+
+class Button extends GuiButton implements IRenderableControl {
+    Button(int id, int x, int y, int width, String name) {
+        super(id, x, y, width, 20, name);
+    }
+
+    Button(int id, int x, int y, int width, String name, boolean enabled) {
+        this(id, x,y,width,name);
+        this.enabled = enabled;
+    }
+
+    @Override
+    public void render(int mouseX, int mouseY) {
+        super.render(mouseX, mouseY, 0f);
+    }
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/gui/CreateControl.java b/src/main/java/com/irtimaled/bbor/client/gui/CreateControl.java
new file mode 100644 (file)
index 0000000..8dd7827
--- /dev/null
@@ -0,0 +1,6 @@
+package com.irtimaled.bbor.client.gui;
+
+@FunctionalInterface
+interface CreateControl {
+    IControl create(Integer id, Integer x, Integer y, Integer width);
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/gui/IControl.java b/src/main/java/com/irtimaled/bbor/client/gui/IControl.java
new file mode 100644 (file)
index 0000000..83252f3
--- /dev/null
@@ -0,0 +1,4 @@
+package com.irtimaled.bbor.client.gui;
+
+interface IControl {
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/gui/IRenderableControl.java b/src/main/java/com/irtimaled/bbor/client/gui/IRenderableControl.java
new file mode 100644 (file)
index 0000000..62bcb60
--- /dev/null
@@ -0,0 +1,5 @@
+package com.irtimaled.bbor.client.gui;
+
+interface IRenderableControl extends IControl {
+    void render(int mouseX, int mouseY);
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/gui/IRowHeight.java b/src/main/java/com/irtimaled/bbor/client/gui/IRowHeight.java
new file mode 100644 (file)
index 0000000..7536212
--- /dev/null
@@ -0,0 +1,5 @@
+package com.irtimaled.bbor.client.gui;
+
+interface IRowHeight extends IControl {
+    double getRowHeight();
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/gui/IntSettingSlider.java b/src/main/java/com/irtimaled/bbor/client/gui/IntSettingSlider.java
new file mode 100644 (file)
index 0000000..2c60488
--- /dev/null
@@ -0,0 +1,86 @@
+package com.irtimaled.bbor.client.gui;
+
+import com.irtimaled.bbor.config.Setting;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.math.MathHelper;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class IntSettingSlider extends Button implements IRenderableControl {
+    private final int maxValue;
+    private final String prefix;
+    private boolean dragging;
+    private Map<Integer, String> displayValues = new HashMap<>();
+
+    final Setting<Integer> setting;
+    final int minValue;
+    final int range;
+    double sliderValue;
+
+    IntSettingSlider(int id, int x, int y, int width, int minValue, int maxValue, String prefix, Setting<Integer> setting) {
+        super(id, x, y, width, "");
+        this.setting = setting;
+        this.minValue = minValue;
+        this.maxValue = maxValue;
+        this.prefix = prefix;
+        this.range = maxValue - minValue;
+        this.sliderValue = getSliderValue();
+        this.displayString = getDisplayValue();
+    }
+
+    IntSettingSlider addDisplayValue(int value, String displayValue) {
+        displayValues.put(value, displayValue);
+        if(setting.get() == value) {
+            this.displayString = getDisplayValue();
+        }
+        return this;
+    }
+
+    private String getDisplayValue() {
+        Integer value = setting.get();
+        return prefix + ": " + displayValues.getOrDefault(value, value.toString());
+    }
+
+    protected Integer getSettingValue() {
+        return MathHelper.clamp(minValue + (int) (range * sliderValue), minValue, maxValue);
+    }
+
+    protected double getSliderValue() {
+        return MathHelper.clamp((setting.get() - minValue) / (double) range, 0d, 1d);
+    }
+
+    @Override
+    protected int getHoverState(boolean p_getHoverState_1_) {
+        return 0;
+    }
+
+    @Override
+    protected void renderBg(Minecraft minecraft, int mouseX, int mouseY) {
+        if (this.dragging) {
+            changeSlider(mouseX);
+        }
+
+        minecraft.getTextureManager().bindTexture(BUTTON_TEXTURES);
+        GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
+        this.drawTexturedModalRect(this.x + (int) (this.sliderValue * (double) (this.width - 8)), this.y, 0, 66, 4, 20);
+        this.drawTexturedModalRect(this.x + (int) (this.sliderValue * (double) (this.width - 8)) + 4, this.y, 196, 66, 4, 20);
+    }
+
+    public final void onClick(double mouseX, double mouseY) {
+        changeSlider(mouseX);
+        this.dragging = true;
+    }
+
+    private void changeSlider(double mouseX) {
+        double proportion = (mouseX - (double) (this.x + 4)) / (double) (this.width - 8);
+        this.sliderValue = MathHelper.clamp(proportion, 0d, 1d);
+        this.setting.set(this.getSettingValue());
+        this.displayString = this.getDisplayValue();
+    }
+
+    public void onRelease(double p_onRelease_1_, double p_onRelease_3_) {
+        this.dragging = false;
+    }
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/gui/MaxYSettingSlider.java b/src/main/java/com/irtimaled/bbor/client/gui/MaxYSettingSlider.java
new file mode 100644 (file)
index 0000000..c727991
--- /dev/null
@@ -0,0 +1,34 @@
+package com.irtimaled.bbor.client.gui;
+
+import com.irtimaled.bbor.config.Setting;
+import net.minecraft.util.math.MathHelper;
+
+class MaxYSettingSlider extends IntSettingSlider {
+    private final int actualMinValue;
+
+    MaxYSettingSlider(int id, int x, int y, int width, int minValue, Setting<Integer> setting) {
+        super(id, x, y, width, minValue - 2, 127, "Max Y", setting);
+        this.actualMinValue = minValue;
+        this.sliderValue = getSliderValue();
+        this.addDisplayValue(-1, "Activated");
+        this.addDisplayValue(0, "Player");
+        this.addDisplayValue(63, "Sea Level");
+    }
+
+    @Override
+    protected Integer getSettingValue() {
+        Integer value = super.getSettingValue();
+        if (value >= actualMinValue)
+            return value;
+        return (value + 1) - actualMinValue;
+    }
+
+    @Override
+    protected double getSliderValue() {
+        int value = setting.get();
+        if (value < actualMinValue)
+            value = (value - 1) + actualMinValue;
+
+        return MathHelper.clamp((value - minValue) / (double) range, 0d, 1d);
+    }
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/gui/SettingsScreen.java b/src/main/java/com/irtimaled/bbor/client/gui/SettingsScreen.java
new file mode 100644 (file)
index 0000000..027668e
--- /dev/null
@@ -0,0 +1,268 @@
+package com.irtimaled.bbor.client.gui;
+
+import com.irtimaled.bbor.client.ClientProxy;
+import com.irtimaled.bbor.common.BoundingBoxType;
+import com.irtimaled.bbor.config.ConfigManager;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.IGuiEventListener;
+import net.minecraft.client.renderer.BufferBuilder;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class SettingsScreen extends GuiScreen {
+    private static final int CONTROLS_WIDTH = 310;
+
+    private final GuiScreen lastScreen;
+    private final int tabIndex;
+
+    private String title;
+    private Set<IRenderableControl> controls = new HashSet<>();
+
+    SettingsScreen(GuiScreen lastScreen, int tabIndex) {
+        this.lastScreen = lastScreen;
+        this.tabIndex = tabIndex;
+
+    }
+
+    public static void show() {
+        Minecraft.getInstance().displayGuiScreen(new SettingsScreen(null, 0));
+    }
+
+    private int getY(double row) {
+        return ((this.height / 6) - 12) + (int) ((row + 2.0) * 24.0);
+    }
+
+    private void addControl(IRenderableControl control) {
+        this.controls.add(control);
+        if (control instanceof IGuiEventListener) {
+            this.eventListeners.add((IGuiEventListener) control);
+        }
+    }
+
+    private void addTabs(String... labels) {
+        int columns = labels.length;
+        int column = 0;
+        int y = getY(-2);
+        for (String label : labels) {
+            final int index = column;
+            addControl(0, column, y, CONTROLS_WIDTH / columns,
+                    (id, x, y1, width) -> new Button(id, x, y, width, label, index != tabIndex) {
+                        public void onClick(double p_onClick_1_, double p_onClick_3_) {
+                            Minecraft.getInstance().displayGuiScreen(new SettingsScreen(lastScreen, index));
+                        }
+                    });
+            column++;
+        }
+
+        //done button
+        addControl(new Button(200, this.width / 2 - 100, getY(5.5), 200, "Done") {
+            public void onClick(double p_onClick_1_, double p_onClick_3_) {
+                ConfigManager.saveConfig();
+                mc.displayGuiScreen(lastScreen);
+            }
+        });
+    }
+
+    private int getX(int width, int column, int offset) {
+        return ((this.width - CONTROLS_WIDTH) / 2) + (column * (width + offset));
+    }
+
+    private IControl addControl(int offset, int column, int y, int width, CreateControl createControl) {
+        int x = getX(width, column, offset);
+        int id = controls.size();
+        IControl control = createControl.create(id, x, y, width);
+        if (control instanceof IRenderableControl)
+            addControl((IRenderableControl) control);
+        return control;
+    }
+
+    private void buildTab(int tabIndex, CreateControl... createControls) {
+        if(tabIndex != this.tabIndex) return;
+
+        int offset = 4;
+        int width = (CONTROLS_WIDTH - (2 * offset)) / 3;
+        int column = 0;
+        double row = -0.75;
+        for (CreateControl createControl : createControls) {
+            int y = getY(row);
+            IControl control = this.addControl(offset, column, y, width, createControl);
+            if (control instanceof IRowHeight) {
+                if (column > 0) {
+                    row++;
+                    column = 0;
+                } else {
+                    row += ((IRowHeight) control).getRowHeight();
+                }
+            } else {
+                column++;
+            }
+            if (column == 3) {
+                column = 0;
+                row++;
+            }
+        }
+    }
+
+    protected void initGui() {
+        this.title = "Bounding Box Outline Reloaded";
+
+        this.controls = new HashSet<>();
+        this.addTabs("General", "Structures", "Villages");
+
+        buildTab(0,
+                (id, x, y, width) -> new Button(id, x, y, width, "Active", this.mc.world != null) {
+                    public void onClick(double p_onClick_1_, double p_onClick_3_) {
+                        ClientProxy.toggleActive();
+                    }
+
+                    protected int getHoverState(boolean p_getHoverState_1_) {
+                        return enabled ? ClientProxy.active ? 2 : 1 : 0;
+                    }
+                },
+                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Outer Box Only", ConfigManager.outerBoxesOnly),
+                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Fill", ConfigManager.fill),
+
+                (id, x, y, width) -> (IRowHeight) () -> 0.5,
+
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Spawn Chunks", BoundingBoxType.WorldSpawn),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Lazy Chunks", BoundingBoxType.LazySpawnChunks),
+                (id, x, y, width) -> new MaxYSettingSlider(id, x, y, width, 39, ConfigManager.worldSpawnMaxY),
+
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Slime Chunks", BoundingBoxType.SlimeChunks),
+                (id, x, y, width) -> new MaxYSettingSlider(id, x, y, width, 39, ConfigManager.slimeChunkMaxY),
+                (id, x, y, width) -> (IRowHeight) () -> 0,
+
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Mob Spawners", BoundingBoxType.MobSpawner),
+                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Spawn Area", ConfigManager.renderMobSpawnerSpawnArea),
+                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Activation Lines", ConfigManager.renderMobSpawnerActivationLines));
+        buildTab(1,
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Desert Temples", BoundingBoxType.DesertTemple),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Jungle Temples", BoundingBoxType.JungleTemple),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Witch Huts", BoundingBoxType.WitchHut),
+
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Mansions", BoundingBoxType.Mansion),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Monuments", BoundingBoxType.OceanMonument),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Igloos", BoundingBoxType.Igloo),
+
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Ocean Ruins", BoundingBoxType.OceanRuin),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Buried Treasure", BoundingBoxType.BuriedTreasure),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Shipwrecks", BoundingBoxType.Shipwreck),
+
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Pillager Outposts", BoundingBoxType.PillagerOutpost),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Strongholds", BoundingBoxType.Stronghold),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Mineshafts", BoundingBoxType.MineShaft),
+
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Fortresses", BoundingBoxType.NetherFortress),
+                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "End Cities", BoundingBoxType.EndCity));
+        buildTab(2,
+                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Villages", ConfigManager.drawVillages),
+                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Door Lines", ConfigManager.drawVillageDoors),
+                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Golem Spawn", ConfigManager.drawIronGolemSpawnArea),
+
+                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Render Sphere", ConfigManager.renderVillageAsSphere),
+                (id, x, y, width) -> new IntSettingSlider(id, x, y, width, 1, 5, "Dot Size", ConfigManager.villageSphereDotSize),
+                (id, x, y, width) -> new IntSettingSlider(id, x, y, width, 1, 5, "Density", ConfigManager.villageSphereDensity)
+                        .addDisplayValue(1, "Fewest")
+                        .addDisplayValue(2, "Fewer")
+                        .addDisplayValue(3, "Normal")
+                        .addDisplayValue(4, "More")
+                        .addDisplayValue(5, "Most"));
+    }
+
+    private void drawScreen(int top, int bottom) {
+        Tessellator tessellator = Tessellator.getInstance();
+        BufferBuilder bufferBuilder = tessellator.getBuffer();
+        this.mc.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
+
+        GlStateManager.disableLighting();
+        GlStateManager.disableFog();
+        GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
+
+        bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
+        bufferBuilder.pos((double) 0, (double) bottom, 0.0D)
+                .tex((double) ((float) 0 / 32.0F), (double) ((float) bottom / 32.0F))
+                .color(32, 32, 32, 255)
+                .endVertex();
+        bufferBuilder.pos((double) this.width, (double) bottom, 0.0D)
+                .tex((double) ((float) this.width / 32.0F), (double) ((float) bottom / 32.0F))
+                .color(32, 32, 32, 255)
+                .endVertex();
+        bufferBuilder.pos((double) this.width, (double) top, 0.0D)
+                .tex((double) ((float) this.width / 32.0F), (double) ((float) top / 32.0F))
+                .color(32, 32, 32, 255)
+                .endVertex();
+        bufferBuilder.pos((double) 0, (double) top, 0.0D)
+                .tex((double) ((float) 0 / 32.0F), (double) ((float) top / 32.0F))
+                .color(32, 32, 32, 255)
+                .endVertex();
+        tessellator.draw();
+
+        GlStateManager.disableDepthTest();
+        GlStateManager.enableBlend();
+        GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE);
+        GlStateManager.disableAlphaTest();
+        GlStateManager.shadeModel(7425);
+        GlStateManager.disableTexture2D();
+
+        bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
+        bufferBuilder.pos((double) 0, (double) (top + 4), 0.0D)
+                .tex(0.0D, 1.0D)
+                .color(0, 0, 0, 0)
+                .endVertex();
+        bufferBuilder.pos((double) this.width, (double) (top + 4), 0.0D)
+                .tex(1.0D, 1.0D)
+                .color(0, 0, 0, 0)
+                .endVertex();
+        bufferBuilder.pos((double) this.width, (double) top, 0.0D)
+                .tex(1.0D, 0.0D)
+                .color(0, 0, 0, 255)
+                .endVertex();
+        bufferBuilder.pos((double) 0, (double) top, 0.0D)
+                .tex(0.0D, 0.0D)
+                .color(0, 0, 0, 255)
+                .endVertex();
+        tessellator.draw();
+
+        bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
+        bufferBuilder.pos((double) 0, (double) bottom, 0.0D)
+                .tex(0.0D, 1.0D)
+                .color(0, 0, 0, 255)
+                .endVertex();
+        bufferBuilder.pos((double) this.width, (double) bottom, 0.0D)
+                .tex(1.0D, 1.0D)
+                .color(0, 0, 0, 255)
+                .endVertex();
+        bufferBuilder.pos((double) this.width, (double) (bottom - 4), 0.0D)
+                .tex(1.0D, 0.0D)
+                .color(0, 0, 0, 0)
+                .endVertex();
+        bufferBuilder.pos((double) 0, (double) (bottom - 4), 0.0D)
+                .tex(0.0D, 0.0D)
+                .color(0, 0, 0, 0)
+                .endVertex();
+        tessellator.draw();
+
+        GlStateManager.enableTexture2D();
+        GlStateManager.shadeModel(7424);
+        GlStateManager.enableAlphaTest();
+        GlStateManager.disableBlend();
+    }
+
+    @Override
+    public void render(int mouseX, int mouseY, float unknown) {
+        if(this.mc.world == null) {
+            this.drawDefaultBackground();
+            this.drawScreen(getY(-1), getY(5.5) - 4);
+        }
+        this.drawCenteredString(this.fontRenderer, this.title, this.width / 2, 15, 16777215);
+        for (IRenderableControl control : controls) {
+            control.render(mouseX, mouseY);
+        }
+    }
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/gui/SettingsScreenButton.java b/src/main/java/com/irtimaled/bbor/client/gui/SettingsScreenButton.java
new file mode 100644 (file)
index 0000000..ef8f8fd
--- /dev/null
@@ -0,0 +1,19 @@
+package com.irtimaled.bbor.client.gui;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.GuiScreen;
+
+public class SettingsScreenButton extends GuiButton {
+    private final SettingsScreen screen;
+
+    public SettingsScreenButton(int id, int x, int y, int height, int width, String label, GuiScreen lastScreen) {
+        super(id, x, y, height, width, label);
+        screen = new SettingsScreen(lastScreen, 0);
+    }
+
+    @Override
+    public void onClick(double p_onClick_1_, double p_onClick_3_) {
+        Minecraft.getInstance().displayGuiScreen(screen);
+    }
+}
index 0bf0bde8cb347fc9b0c98b402367aa9845d9821e..bc3839f25487778e8fc397fbf33d8299f467578a 100644 (file)
@@ -75,6 +75,7 @@ public class VillageRenderer extends Renderer<BoundingBoxVillage> {
 
     private void renderSphere(OffsetPoint center, double radius, Color color) {
         GL11.glEnable(GL11.GL_POINT_SMOOTH);
+        GL11.glPointSize(ConfigManager.villageSphereDotSize.get());
 
         Tessellator tessellator = Tessellator.getInstance();
         BufferBuilder worldRenderer = tessellator.getBuffer();
index 5b8ba4324ca43911271719dc82b9af613ca6ba4f..51d95bfabff922aa610628246d428017e357029c 100644 (file)
@@ -42,7 +42,7 @@ public class BoundingBoxType {
 
     private final Color color;
     private final String name;
-    private final Setting<Boolean> shouldRenderSetting;
+    public final Setting<Boolean> shouldRenderSetting;
 
     private BoundingBoxType(Color color, String name, Setting<Boolean> shouldRenderSetting) {
         this.color = color;
diff --git a/src/main/java/com/irtimaled/bbor/mixin/client/gui/MixinGuiOptions.java b/src/main/java/com/irtimaled/bbor/mixin/client/gui/MixinGuiOptions.java
new file mode 100644 (file)
index 0000000..793d72a
--- /dev/null
@@ -0,0 +1,23 @@
+package com.irtimaled.bbor.mixin.client.gui;
+
+import com.irtimaled.bbor.client.gui.SettingsScreenButton;
+import net.minecraft.client.gui.*;
+import net.minecraft.client.resources.I18n;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(GuiOptions.class)
+public class MixinGuiOptions extends GuiScreen {
+    @Inject(method = "initGui", at = @At("RETURN"))
+    private void initGui(CallbackInfo ci) {
+        //shuffle middle buttons up by 12 px to make space
+        int top = this.height / 6 + 42;
+        for(GuiButton button : buttons) {
+            if (button.id != 200 && button.y >= top)
+                button.y -= 12;
+        }
+        this.addButton(new SettingsScreenButton(200, this.width / 2 - 155, top + 84, 150, 20, "BBOR", this));
+    }
+}
index 904af56f1469c272073c1475ba937d629b1d5675..3e1f43f272844f261efcac268ab55e1e2d9b1eec 100644 (file)
@@ -17,6 +17,7 @@
   ],
   "client": [
     "client.MixinMinecraft",
+    "client.gui.MixinGuiOptions",
     "client.renderer.MixinEntityRenderer",
     "client.multiplayer.MixinWorldClient",
     "client.network.MixinNetHandlerLoginClient",