Skip to content

Commit

Permalink
make chunks reload when legacy water colors is toggled
Browse files Browse the repository at this point in the history
  • Loading branch information
Jab125 committed Jan 4, 2025
1 parent 14c01e8 commit bc0c5ff
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ public class TweakBuilder {
private String description;
private boolean defaultEnabled = true;
private String[] authors;
private Runnable onToggled = () -> {};
private Runnable onEnable = () -> {};
private Runnable onDisable = () -> {};

public TweakBuilder(String tweakID) {
this.id = tweakID;
Expand All @@ -32,8 +35,29 @@ public TweakBuilder setDefaultEnabled(boolean defaultEnabled) {
return this;
}

public TweakBuilder onToggled(Runnable onToggled) {
this.onToggled = onToggled;
return this;
}

public Tweak build() {
Tweak tweak = new Tweak(id) {
@Override
public void onEnable() {
this.onToggled();
onEnable.run();
}

@Override
public void onDisable() {
this.onToggled();
onDisable.run();
}

@Override
public void onToggled() {
onToggled.run();
}
};
tweak.setTweakDescription(description);
tweak.setDefaultEnabled(defaultEnabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ public EyeCandy() {
addSubTweak(models = new Models());
addSubTweak(smallerStars = new TweakBuilder("Smaller Stars").description("Makes the stars smaller, like LCE").authors("Permdog99").setDefaultEnabled(true).build());
addSubTweak(oldButton = new TweakBuilder("Pre 1.13 button").description("Reverts buttons to their pre 1.14 state").authors("Jab125").setDefaultEnabled(true).build());
addSubTweak(legacyWaterColors = new TweakBuilder("Legacy Water Colors").description("앚졸딩도알lk노wn라w소f아v이앋이온텔에잇노왜압에엣호울d베압렏오f뤼잊윙살엗오옷말l독엗잊f앋릳t렙옫요ff텍로운d텝에어f조울세f리엣안위왭엦아웃엡에엣돈t잘에w핱움안s틴깃임봈입레").authors("Jab125", "dexrn").setDefaultEnabled(true).build());
addSubTweak(legacyWaterColors = new TweakBuilder("Legacy Water Colors").description("앚졸딩도알lk노wn라w소f아v이앋이온텔에잇노왜압에엣호울d베압렏오f뤼잊윙살엗오옷말l독엗잊f앋릳t렙옫요ff텍로운d텝에어f조울세f리엣안위왭엦아웃엡에엣돈t잘에w핱움안s틴깃임봈입레").authors("Jab125", "dexrn").setDefaultEnabled(true).onToggled(() -> {
//noinspection ConstantValue
if (Minecraft.getInstance().levelRenderer != null) {
Minecraft.getInstance().levelRenderer.allChanged();
}
}).build());
}
public static class LegacyTextShadows extends Tweak {
public final IntSliderOption shadowOffset;
Expand Down

0 comments on commit bc0c5ff

Please sign in to comment.