Version 1.3.0-beta1 (Fabric) (#17)

* [1.3.0-beta1] Update to 1.21.11

* Fix deploy workflow
This commit is contained in:
2025-12-10 18:21:53 +13:00
committed by GitHub
parent 80d34ab146
commit cdf5cd5d95
16 changed files with 40 additions and 70 deletions

View File

@@ -10,8 +10,10 @@ public abstract class Key {
public KeyBinding keybind;
public MinecraftClient mc = MinecraftClient.getInstance();
public Key(@NotNull String name) {
keybind = new KeyBinding(this.getDisplayName(), this.getKeyType(), this.getKey(), this.getCategory());
private static final KeyBinding.Category CATEGORY = KeyBinding.Category.create(Identifier.of("weatherchanger"));
public Key() {
keybind = new KeyBinding(this.getDisplayName(), this.getKeyType(), this.getKey(), CATEGORY);
}
public abstract void onPress(@NotNull MinecraftClient client);
@@ -20,6 +22,5 @@ public abstract class Key {
public abstract boolean isEnabled();
public abstract String getDisplayName();
public abstract InputUtil.Type getKeyType();
public abstract String getCategory();
public abstract int getKey();
}

View File

@@ -12,10 +12,6 @@ import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
public class ToggleClearKey extends Key {
public ToggleClearKey() {
super("ToggleClearKey");
}
@Override
public void onPress(@NotNull MinecraftClient client) {
WeatherChanger.setMode(WcMode.CLEAR);
@@ -48,11 +44,6 @@ public class ToggleClearKey extends Key {
return InputUtil.Type.KEYSYM;
}
@Override
public String getCategory() {
return "Weather Changer";
}
@Override
public int getKey() {
return -1;

View File

@@ -12,10 +12,6 @@ import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
public class ToggleOffKey extends Key {
public ToggleOffKey() {
super("ToggleOffKey");
}
@Override
public void onPress(@NotNull MinecraftClient client) {
WeatherChanger.setMode(WcMode.OFF);
@@ -48,11 +44,6 @@ public class ToggleOffKey extends Key {
return InputUtil.Type.KEYSYM;
}
@Override
public String getCategory() {
return "Weather Changer";
}
@Override
public int getKey() {
return -1;

View File

@@ -12,10 +12,6 @@ import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
public class ToggleRainKey extends Key {
public ToggleRainKey() {
super("ToggleRainKey");
}
@Override
public void onPress(@NotNull MinecraftClient client) {
WeatherChanger.setMode(WcMode.RAIN);
@@ -48,11 +44,6 @@ public class ToggleRainKey extends Key {
return InputUtil.Type.KEYSYM;
}
@Override
public String getCategory() {
return "Weather Changer";
}
@Override
public int getKey() {
return -1;

View File

@@ -12,10 +12,6 @@ import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
public class ToggleThunderKey extends Key {
public ToggleThunderKey() {
super("ToggleThunderKey");
}
@Override
public void onPress(@NotNull MinecraftClient client) {
WeatherChanger.setMode(WcMode.THUNDER);
@@ -48,11 +44,6 @@ public class ToggleThunderKey extends Key {
return InputUtil.Type.KEYSYM;
}
@Override
public String getCategory() {
return "Weather Changer";
}
@Override
public int getKey() {
return -1;

View File

@@ -20,11 +20,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(World.class)
public class WorldMixin {
@Shadow
protected float rainGradientPrev;
protected float lastRainGradient;
@Shadow
protected float rainGradient;
@Shadow
protected float thunderGradientPrev;
protected float lastThunderGradient;
@Shadow
protected float thunderGradient;
@@ -32,12 +32,12 @@ public class WorldMixin {
@Unique
private float weatherChanger$getRainGradientOg(float delta) {
return MathHelper.lerp(delta, this.rainGradientPrev, this.rainGradient);
return MathHelper.lerp(delta, this.lastRainGradient, this.rainGradient);
}
@Unique
private float weatherChanger$getThunderGradientOg(float delta) {
return MathHelper.lerp(delta, this.thunderGradientPrev, this.thunderGradient) * this.weatherChanger$getRainGradientOg(delta);
return MathHelper.lerp(delta, this.lastThunderGradient, this.thunderGradient) * this.weatherChanger$getRainGradientOg(delta);
}
@Unique
@@ -54,7 +54,7 @@ public class WorldMixin {
} else if (mode == WcMode.RAIN || mode == WcMode.THUNDER) {
callback.setReturnValue(1F);
} else {
callback.setReturnValue(MathHelper.lerp(delta, this.rainGradientPrev, this.rainGradient));
callback.setReturnValue(MathHelper.lerp(delta, this.lastRainGradient, this.rainGradient));
}
callback.cancel();
@@ -69,7 +69,7 @@ public class WorldMixin {
} else if (mode == WcMode.THUNDER) {
callback.setReturnValue(1F);
} else {
callback.setReturnValue(MathHelper.lerp(delta, this.thunderGradientPrev, this.thunderGradient) * MathHelper.lerp(delta, this.rainGradientPrev, this.rainGradient));
callback.setReturnValue(MathHelper.lerp(delta, this.lastThunderGradient, this.thunderGradient) * MathHelper.lerp(delta, this.lastRainGradient, this.rainGradient));
}
callback.cancel();
@@ -83,7 +83,6 @@ public class WorldMixin {
@Inject(method = "isThundering", at = @At("HEAD"), cancellable = true)
public void isThundering(CallbackInfoReturnable<Boolean> callback) {
if (this.weatherChanger$getDimension().hasSkyLight() && !(this.weatherChanger$getDimension().hasCeiling())) {
callback.setReturnValue((double)this.weatherChanger$getThunderGradientOg(1.0F) > 0.9);
} else {

View File

@@ -1,4 +1,5 @@
{
"key.category.minecraft.weatherchanger": "Weather Changer",
"commands.weatherchanger.set.off": "Set client weather to: Off",
"commands.weatherchanger.set.clear": "Set client weather to: Clear",
"commands.weatherchanger.set.rain": "Set client weather to: Rain",