|
1 | 1 | package org.polyfrost.polyweather.mixin.client; |
2 | 2 |
|
3 | | -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; |
4 | | -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; |
5 | 3 | //? if >=1.21.4 { |
6 | | -import net.minecraft.client.multiplayer.ClientLevel; |
| 4 | +import com.llamalad7.mixinextras.injector.ModifyReturnValue; |
7 | 5 | import net.minecraft.client.renderer.WeatherEffectRenderer; |
8 | | -import org.polyfrost.polyweather.client.ClientWeatherManager; |
9 | 6 | //?} else { |
10 | | -/*import net.minecraft.client.renderer.LevelRenderer; |
11 | | -import net.minecraft.world.level.biome.Biome; |
| 7 | +/*import com.llamalad7.mixinextras.injector.wrapoperation.Operation; |
| 8 | +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; |
| 9 | +import net.minecraft.client.renderer.LevelRenderer; |
| 10 | +import net.minecraft.core.BlockPos; |
12 | 11 | *///?} |
| 12 | +import net.minecraft.world.level.biome.Biome; |
| 13 | +import org.polyfrost.polyweather.client.ClientWeatherManager; |
13 | 14 | import org.polyfrost.polyweather.client.PolyWeatherConfig; |
14 | 15 | import org.spongepowered.asm.mixin.Mixin; |
15 | 16 | import org.spongepowered.asm.mixin.injection.At; |
|
20 | 21 | /*@Mixin(LevelRenderer.class) |
21 | 22 | *///?} |
22 | 23 | public class Mixin_AllowWeatherEverywhere { |
23 | | - @WrapOperation(method = /*? if >=1.21.4 {*/ "tickRainParticles" /*?} else {*/ /*"renderSnowAndRain" *//*?}*/, at = @At(value = "INVOKE", target = /*? if >=1.21.4 {*/ "Lnet/minecraft/client/multiplayer/ClientLevel;getRainLevel(F)F" /*?} else {*/ /*"Lnet/minecraft/world/level/biome/Biome;hasPrecipitation()Z" *//*?}*/)) |
24 | | - private /*? if >=1.21.4 {*/ float /*?} else {*/ /*boolean *//*?}*/ allowRainEverywhere(/*? if >=1.21.4 {*/ ClientLevel instance, float delta /*?} else {*/ /*Biome instance *//*?}*/, Operation</*? if >=1.21.4 {*/ Float /*?} else {*/ /*Boolean *//*?}*/> original) { |
| 24 | + //? if >=1.21.4 { |
| 25 | + @ModifyReturnValue(method = "getPrecipitationAt", at = @At("RETURN")) |
| 26 | + //?} else { |
| 27 | + /*@WrapOperation(method = "renderSnowAndRain", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/biome/Biome;getPrecipitationAt(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/biome/Biome$Precipitation;")) |
| 28 | + *///?} |
| 29 | + private Biome.Precipitation changeWeather(/*? if >=1.21.4 {*/ Biome.Precipitation original /*?} else {*/ /*Biome instance, BlockPos pos, Operation<Biome.Precipitation> original *//*?}*/) { |
| 30 | + if (PolyWeatherConfig.isEnabled()) { |
| 31 | + if (ClientWeatherManager.isSnowy()) { |
| 32 | + return Biome.Precipitation.SNOW; |
| 33 | + } else if (ClientWeatherManager.isRainy()) { |
| 34 | + return Biome.Precipitation.RAIN; |
| 35 | + } else { |
| 36 | + return Biome.Precipitation.NONE; |
| 37 | + } |
| 38 | + } |
| 39 | + |
| 40 | + |
| 41 | + return original/*? if <1.21.4 {*//*.call(instance, pos) *//*?}*/; |
| 42 | + } |
| 43 | + |
| 44 | + //? if <1.21.4 { |
| 45 | + /*@WrapOperation(method = "renderSnowAndRain", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/biome/Biome;hasPrecipitation()Z")) |
| 46 | + private boolean allowWeatherEverywhere(Biome instance, Operation<Boolean> original) { |
25 | 47 | if (PolyWeatherConfig.isEnabled()) { |
26 | | - //? if >=1.21.4 { |
27 | | - return ClientWeatherManager.getPrecipitationStrength(delta); |
28 | | - //?} else { |
29 | | - /*return true; |
30 | | - *///?} |
| 48 | + return true; |
31 | 49 | } |
32 | 50 |
|
33 | | - return original.call(instance /*? if >=1.21.4 {*/, delta /*?}*/); |
| 51 | + return original.call(instance); |
34 | 52 | } |
| 53 | + *///?} |
35 | 54 | } |
0 commit comments