From 3963429de67774bb1c0a779b6ffbbe369f94fcb1 Mon Sep 17 00:00:00 2001 From: Wynd Date: Sat, 12 Apr 2025 11:42:48 +0300 Subject: [PATCH] Ported the new cloud toggle and cloud height menu options --- .../minecraft/src/GuiVideoSettings.java.patch | 54 +++++++++++++++++ .../net/minecraft/src/RenderGlobal.java.patch | 2 +- .../minecraft/src/finalbeta/ModSlider.java | 60 +++++++++++-------- .../net/minecraft/src/mod_FinalBeta.java | 3 +- 4 files changed, 91 insertions(+), 28 deletions(-) create mode 100644 src/minecraft/net/minecraft/src/GuiVideoSettings.java.patch diff --git a/src/minecraft/net/minecraft/src/GuiVideoSettings.java.patch b/src/minecraft/net/minecraft/src/GuiVideoSettings.java.patch new file mode 100644 index 0000000..322e006 --- /dev/null +++ b/src/minecraft/net/minecraft/src/GuiVideoSettings.java.patch @@ -0,0 +1,54 @@ +--- src/GuiVideoSettings.java.bak 2025-04-11 18:43:28.370069729 +0300 ++++ src/GuiVideoSettings.java 2025-04-12 01:36:57.502135584 +0300 +@@ -6,6 +6,8 @@ + + import java.util.List; + import net.minecraft.client.Minecraft; ++import net.minecraft.src.finalbeta.ModConfig; ++import net.minecraft.src.finalbeta.ModSlider; + + // Referenced classes of package net.minecraft.src: + // GuiScreen, StringTranslate, EnumOptions, GuiSmallButton, +@@ -42,6 +44,9 @@ + } + + controlList.add(new GuiButton(200, width / 2 - 100, height / 6 + 168, stringtranslate.translateKey("gui.done"))); ++ ++ this.controlList.add(new GuiButton(300, this.width / 2 - 155, this.height / 6 + 96, 150, 20, this.getCloudsLabel())); ++ this.controlList.add(new ModSlider(301, this.width / 2 + 5, this.height / 6 + 96, this.getCloudHeightLabel(), ModConfig.CLOUDS_HEIGHT.get().floatValue())); + } + + protected void actionPerformed(GuiButton guibutton) +@@ -50,6 +55,16 @@ + { + return; + } ++ ++ if (guibutton.id == 300) { ++ ModConfig.ENABLE_CLOUDS.set(!ModConfig.ENABLE_CLOUDS.get()); ++ guibutton.displayString = this.getCloudsLabel(); ++ return; ++ } ++ else if (guibutton.id == 301) { ++ return; ++ } ++ + if(guibutton.id < 100 && (guibutton instanceof GuiSmallButton)) + { + guiGameSettings.setOptionValue(((GuiSmallButton)guibutton).returnEnumOptions(), 1); +@@ -73,6 +88,15 @@ + super.drawScreen(i, j, f); + } + ++ private String getCloudsLabel() { ++ StringTranslate i18n = StringTranslate.getInstance(); ++ return "Clouds: " + (ModConfig.ENABLE_CLOUDS.get() ? i18n.translateKey("options.on") : i18n.translateKey("options.off")); ++ } ++ ++ private String getCloudHeightLabel() { ++ return "Clouds Height: "; ++ } ++ + private GuiScreen field_22110_h; + protected String field_22107_a; + private GameSettings guiGameSettings; diff --git a/src/minecraft/net/minecraft/src/RenderGlobal.java.patch b/src/minecraft/net/minecraft/src/RenderGlobal.java.patch index 428361d..2334afe 100644 --- a/src/minecraft/net/minecraft/src/RenderGlobal.java.patch +++ b/src/minecraft/net/minecraft/src/RenderGlobal.java.patch @@ -1,5 +1,5 @@ --- src/RenderGlobal.java.bak 2025-04-05 22:12:27.557016177 +0300 -+++ src/RenderGlobal.java 2025-04-06 19:19:53.715033418 +0300 ++++ src/RenderGlobal.java 2025-04-12 11:38:55.802675608 +0300 @@ -7,6 +7,7 @@ import java.nio.IntBuffer; import java.util.*; diff --git a/src/minecraft/net/minecraft/src/finalbeta/ModSlider.java b/src/minecraft/net/minecraft/src/finalbeta/ModSlider.java index e895c21..bf03e25 100644 --- a/src/minecraft/net/minecraft/src/finalbeta/ModSlider.java +++ b/src/minecraft/net/minecraft/src/finalbeta/ModSlider.java @@ -8,14 +8,15 @@ public class ModSlider extends GuiButton { public float value = 1.0F; public boolean dragged = false; public final String defaultText; - private final IChanceValue changeEvent; - public ModSlider(int id, int x, int y, String label, float initialValue, IChanceValue changeEvent) { + public ModSlider(int id, int x, int y, String label, float initialValue) { super(id, x, y, 150, 20, label); this.value = initialValue; this.defaultText = label; - this.changeEvent = changeEvent; this.displayString = this.defaultText + "" + String.format("%.2f", this.value); + if (this.id == 301) { + this.displayString = this.getCloudHeightString(); + } } @Override @@ -24,28 +25,38 @@ public class ModSlider extends GuiButton { } @Override - public void drawButton(Minecraft minecraft, int i, int j) { - if (this.enabled2) { - if (this.dragged) { - this.value = (float) (i - (this.xPosition + 4)) / (float) (this.width - 8); - if (this.value < 0.0F) { - this.value = 0.0F; - } - - if (this.value > 1.0F) { - this.value = 1.0F; - } - - this.changeEvent.changeValue(this.value); - this.displayString = this.defaultText + "" + String.format("%.2f", this.value); + public void mouseDragged(Minecraft minecraft, int i, int j) { + if (!this.enabled2) { + return; + } + + if (this.dragged) { + this.value = (float) (i - (this.xPosition + 4)) / (float) (this.width - 8); + if (this.value < 0.0F) { + this.value = 0.0F; } - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.drawTexturedModalRect(this.xPosition + (int) (this.value * (this.width - 8)), this.yPosition, 0, 66, 4, 20); - this.drawTexturedModalRect(this.xPosition + (int) (this.value * (this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); + if (this.value > 1.0F) { + this.value = 1.0F; + } + + this.displayString = this.defaultText + "" + String.format("%.2f", this.value); + + if (this.id == 301) { + ModConfig.CLOUDS_HEIGHT.set((double) this.value); + this.displayString = this.getCloudHeightString(); + } } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.xPosition + (int) (this.value * (this.width - 8)), this.yPosition, 0, 66, 4, 20); + this.drawTexturedModalRect(this.xPosition + (int) (this.value * (this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); } + private String getCloudHeightString() { + return this.defaultText + "" + String.format("%.2f", 108.0f + (108.0f * 2.0f * this.value)); + } + @Override public boolean mousePressed(Minecraft minecraft, int i, int j) { if (super.mousePressed(minecraft, i, j)) { @@ -58,7 +69,10 @@ public class ModSlider extends GuiButton { this.value = 1.0F; } - this.changeEvent.changeValue(this.value); + if (this.id == 301) { + ModConfig.CLOUDS_HEIGHT.set((double) this.value); + } + this.displayString = this.defaultText + "" + String.format("%.2f", this.value); this.dragged = true; return true; @@ -71,8 +85,4 @@ public class ModSlider extends GuiButton { public void mouseReleased(int i, int j) { this.dragged = false; } - - public interface IChanceValue { - void changeValue(float value); - } } diff --git a/src/minecraft/net/minecraft/src/mod_FinalBeta.java b/src/minecraft/net/minecraft/src/mod_FinalBeta.java index bcfb5d6..b3c7ac3 100644 --- a/src/minecraft/net/minecraft/src/mod_FinalBeta.java +++ b/src/minecraft/net/minecraft/src/mod_FinalBeta.java @@ -81,8 +81,7 @@ public class mod_FinalBeta extends BaseMod { // DEBUG stuff if (this.canPressKey(Keyboard.KEY_O)) { -// minecraft.thePlayer.dropItem(Block.oreGold.blockID, 64); -// minecraft.thePlayer.dropItem(Item.coal.shiftedIndex, 64); +// minecraft.thePlayer.dropItem(Block.oreLapis.blockID, 64); // minecraft.theWorld.setWorldTime(0); } else {