Ported the new cloud toggle and cloud height menu options
parent
0f6f37dffe
commit
3963429de6
|
@ -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;
|
|
@ -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.*;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue