From 45a21060543ba9a9c9df0dd76c829631b109b1fa Mon Sep 17 00:00:00 2001 From: Liz Graham Date: Fri, 25 Mar 2022 17:33:15 +0000 Subject: [PATCH] move shouldParticlesSpawn to own class --- .../lizistired/cavedust/utils/MathHelper.java | 33 ------------------- .../cavedust/utils/ParticleSpawnUtil.java | 1 - 2 files changed, 34 deletions(-) diff --git a/src/main/java/net/lizistired/cavedust/utils/MathHelper.java b/src/main/java/net/lizistired/cavedust/utils/MathHelper.java index 59c2051..f34172e 100644 --- a/src/main/java/net/lizistired/cavedust/utils/MathHelper.java +++ b/src/main/java/net/lizistired/cavedust/utils/MathHelper.java @@ -20,8 +20,6 @@ import java.util.concurrent.ThreadLocalRandom; import static net.minecraft.world.biome.BiomeKeys.LUSH_CAVES; public class MathHelper { - private static float timer; - public static boolean shouldParticlesSpawn; public static double normalize(double min, double max, double val) { return 1 - ((val - min) / (max - min)); @@ -40,35 +38,4 @@ public class MathHelper { return ThreadLocalRandom.current().nextDouble(min, max); } - 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; - } } diff --git a/src/main/java/net/lizistired/cavedust/utils/ParticleSpawnUtil.java b/src/main/java/net/lizistired/cavedust/utils/ParticleSpawnUtil.java index 25403eb..6b69762 100644 --- a/src/main/java/net/lizistired/cavedust/utils/ParticleSpawnUtil.java +++ b/src/main/java/net/lizistired/cavedust/utils/ParticleSpawnUtil.java @@ -19,7 +19,6 @@ public class ParticleSpawnUtil { || 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;