Fixup CPE snowing injection

This commit is contained in:
FlorianMichael 2024-10-27 01:18:58 +02:00
parent ef6076aa07
commit 059651250e
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -27,11 +27,21 @@ import net.minecraft.world.biome.Biome;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(WeatherRendering.class) @Mixin(WeatherRendering.class)
public abstract class MixinWeatherRendering { public abstract class MixinWeatherRendering {
@Redirect(method = "renderPrecipitation(Lnet/minecraft/world/World;Lnet/minecraft/client/render/LightmapTextureManager;IFLnet/minecraft/util/math/Vec3d;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getRainGradient(F)F"))
private float forceSnow(World instance, float delta) {
if (CPEAdditions.isSnowing()) {
return 1F;
} else {
return instance.getRainGradient(delta);
}
}
@Inject(method = "getPrecipitationAt", at = @At(value = "HEAD"), cancellable = true) @Inject(method = "getPrecipitationAt", at = @At(value = "HEAD"), cancellable = true)
private void forceSnow(World world, BlockPos pos, CallbackInfoReturnable<Biome.Precipitation> cir) { private void forceSnow(World world, BlockPos pos, CallbackInfoReturnable<Biome.Precipitation> cir) {
if (CPEAdditions.isSnowing()) { if (CPEAdditions.isSnowing()) {