hopefully fix workflow ??

This commit is contained in:
Liz Graham
2022-03-25 15:00:47 +00:00
parent f26764f5c9
commit 0bf6db4415
2 changed files with 47 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ jobs:
java: 17
dependencies: |
fabric-api | depends | 0.46.0
fabric | depends | 0.46.0
kirin | includes | 1.10.0-beta.2
modmenu | recommends | *

View File

@@ -0,0 +1,46 @@
package net.lizistired.cavedust.utils;
import net.lizistired.cavedust.CaveDustConfig;
import net.minecraft.client.MinecraftClient;
import net.minecraft.world.World;
import java.util.Objects;
import java.util.Optional;
import static net.minecraft.world.biome.BiomeKeys.LUSH_CAVES;
public class ParticleSpawnUtil {
private static float timer;
public static boolean shouldParticlesSpawn;
public static boolean shouldParticlesSpawn(MinecraftClient client, CaveDustConfig config) {
//checks if the config is enabled, if the game isn't paused, if the world is valid, if the particle is valid and if the player isn't in a lush caves biome
if (!config.getCaveDustEnabled()
|| client.isPaused()
|| client.world == null
|| !client.world.getDimension().isBedWorking()
|| Objects.equals(client.world.getBiomeKey(Objects.requireNonNull(client.player).getBlockPos()), Optional.of(LUSH_CAVES))
|| Objects.requireNonNull(client.player).isSubmergedInWater())
{
timer = 0;
shouldParticlesSpawn = false;
return false;
}
World world = client.world;
int seaLevel = world.getSeaLevel();
if (!client.player.clientWorld.isSkyVisible(client.player.getBlockPos())) {
if (client.player.getBlockPos().getY() < seaLevel){
timer = timer + 1;
if (timer > 10){
timer = 10;
shouldParticlesSpawn = true;
return true;
}
}
}
shouldParticlesSpawn = false;
return false;
}
}