Compare commits

..

8 Commits

Author SHA1 Message Date
Liz Graham
de0983047a Bump to 1.4.0 2023-05-22 03:30:29 +01:00
Liz Graham
f453148c35 Improve error handling for incompatible particles 2023-05-22 03:29:40 +01:00
Liz Graham
5f48fec41a Fix bugs and fix #4
Particles can no longer spawn under the world.
Particles no longer spawn in blocks, instead spawning in air.
Fixed bug present since 1.2.0, which meant particle amount was dependant on blocks around player.
New particle multiplier allowing greater control of particle amount.
New F3 screen text, allows user to debug particle amount.
Removed upper and lower limit buttons.
2023-05-22 03:26:21 +01:00
Liz Graham
c345b7822c UI update 2023-05-22 03:23:13 +01:00
Liz Graham
0a49b2d459 Update build-release.yml 2023-05-21 23:27:16 +01:00
Liz Graham
282ce2e1af Bump to 1.3.0 2023-05-21 07:47:32 +01:00
Liz Graham
ec342b7506 Update README.md 2023-05-21 07:44:22 +01:00
Liz Graham
b8a45b3ed5 set default id to white ash's id 2023-05-21 07:30:04 +01:00
20 changed files with 108 additions and 197 deletions

View File

@@ -40,3 +40,5 @@ jobs:
curseforge-id: 594750 curseforge-id: 594750
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.5-SNAPSHOT' id 'fabric-loom' version '1.2-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }

View File

@@ -3,17 +3,17 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.20.4 minecraft_version=1.19.3
yarn_mappings=1.20.4+build.3 yarn_mappings=1.19.3+build.5
loader_version=0.15.5 loader_version=0.14.13
# Mod Properties # Mod Properties
mod_version=1.4.1 mod_version = 1.4.0
maven_group=com.lizistired maven_group = com.lizistired
archives_base_name=cave_dust archives_base_name = cave_dust
# Dependencies # Dependencies
fabric_version=0.94.0+1.20.4 fabric_version=0.72.0+1.19.3
clothconfig_version=13.0.121 clothconfig_version =9.0.94
modmenu_version=9.0.0 modmenu_version =5.1.0-beta.3
kirin_version=1.17.0+1.20.4 kirin_version=1.13.2

Binary file not shown.

View File

@@ -1,6 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

25
gradlew vendored
View File

@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,11 +80,14 @@ do
esac esac
done done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -140,16 +143,12 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -194,10 +193,6 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
@@ -210,12 +205,6 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.

15
gradlew.bat vendored
View File

@@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@@ -25,8 +25,7 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@@ -41,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -76,15 +75,13 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd if "%ERRORLEVEL%"=="0" goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL% if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
if %EXIT_CODE% equ 0 set EXIT_CODE=1 exit /b 1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View File

@@ -1,8 +1,9 @@
package net.lizistired.cavedust; package net.lizistired.cavedust;
//minecraft imports //minecraft imports
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -39,12 +40,10 @@ public class CaveDust implements ClientModInitializer {
return config; return config;
} }
public static int WHITE_ASH_ID = Registries.PARTICLE_TYPE.getRawId(CaveDustServer.CAVE_DUST); public static int WHITE_ASH_ID = Registries.PARTICLE_TYPE.getRawId(ParticleTypes.WHITE_ASH);
public static int PARTICLE_AMOUNT = 0; public static int PARTICLE_AMOUNT = 0;
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
//config path and loading //config path and loading
@@ -52,7 +51,6 @@ public class CaveDust implements ClientModInitializer {
config = new CaveDustConfig(CaveDustFolder.getParent().resolve("cavedust.json"), this); config = new CaveDustConfig(CaveDustFolder.getParent().resolve("cavedust.json"), this);
config.load(); config.load();
registerKeyBindings(); registerKeyBindings();
ParticleFactoryRegistry.getInstance().register(CaveDustServer.CAVE_DUST, CaveDustParticleFactory.Factory::new);
//register end client tick to create cave dust function, using end client tick for async //register end client tick to create cave dust function, using end client tick for async
ClientTickEvents.END_CLIENT_TICK.register(this::createCaveDust); ClientTickEvents.END_CLIENT_TICK.register(this::createCaveDust);
@@ -80,23 +78,20 @@ public class CaveDust implements ClientModInitializer {
for (int i = 0; i < PARTICLE_AMOUNT; i++) { for (int i = 0; i < PARTICLE_AMOUNT; i++) {
try { try {
int x = (int) (client.player.getPos().getX() + (int) generateRandomDouble(config.getDimensionWidth() *-1, config.getDimensionWidth())); double x = client.player.getPos().getX() + generateRandomDouble(config.getDimensionsX() * -1, config.getDimensionsX());
int y = (int) (client.player.getEyePos().getY() + (int) generateRandomDouble(config.getDimensionHeight() *-1, config.getDimensionHeight())); double y = client.player.getPos().getY() + generateRandomDouble(config.getDimensionsY() * -1, config.getDimensionsY());
int z = (int) (client.player.getPos().getZ() + (int) generateRandomDouble(config.getDimensionWidth() *-1, config.getDimensionWidth())); double z = client.player.getPos().getZ() + generateRandomDouble(config.getDimensionsZ() * -1, config.getDimensionsZ());
double miniX = (x + Math.random());
double miniY = (y + Math.random());
double miniZ = (z + Math.random());
BlockPos particlePos = new BlockPos(x, y, z); BlockPos particlePos = new BlockPos(x, y, z);
if (shouldParticlesSpawn(client, config, particlePos)) { if (shouldParticlesSpawn(client, config, particlePos)) {
if (client.world.getBlockState(particlePos).isAir()) { if (client.world.getBlockState(particlePos).isAir()) {
world.addParticle(config.getParticle(), miniX, miniY, miniZ, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01); world.addParticle(config.getParticle(), x, y, z, config.getVelocityRandomnessRandom(), config.getVelocityRandomnessRandom(), config.getVelocityRandomnessRandom());
} }
} }
} }
catch (NullPointerException e) { catch (NullPointerException e) {
LOGGER.error(String.valueOf(e)); LOGGER.error(String.valueOf(e));
//getConfig().setParticleID(WHITE_ASH_ID); getConfig().setParticleID(WHITE_ASH_ID);
} }
} }
} }

View File

@@ -16,9 +16,10 @@ public class CaveDustConfig extends JsonFile {
private transient final net.lizistired.cavedust.CaveDust CaveDust; private transient final net.lizistired.cavedust.CaveDust CaveDust;
private int width = 10; private int dimensionX = 5;
private int height = 10; private int dimensionY = 5;
private int velocityRandomness = 0; private int dimensionZ = 5;
private int velocityRandomness = 1;
private boolean caveDustEnabled = true; private boolean caveDustEnabled = true;
private boolean seaLevelCheck = true; private boolean seaLevelCheck = true;
@@ -36,28 +37,40 @@ public class CaveDustConfig extends JsonFile {
this.CaveDust = caveDust; this.CaveDust = caveDust;
} }
public float setDimensionWidth(float size){ public float setDimensionsX(float size){
if (this.width != size) { if (this.dimensionX != size) {
this.width = (int)size; this.dimensionX = (int)size;
save(); save();
} }
return getDimensionWidth(); return getDimensionsX();
} }
public float setDimensionHeight(float size){ public float setDimensionsY(float size){
if (this.height != size) { if (this.dimensionY != size) {
this.height = (int)size; this.dimensionY = (int)size;
save(); save();
} }
return getDimensionHeight(); return getDimensionsY();
} }
public float getDimensionWidth(){ public float setDimensionsZ(float size){
return width; if (this.dimensionZ != size) {
this.dimensionZ = (int)size;
save();
}
return getDimensionsZ();
} }
public float getDimensionHeight(){ public float getDimensionsX(){
return height; return dimensionX;
}
public float getDimensionsY(){
return dimensionY;
}
public float getDimensionsZ(){
return dimensionZ;
} }
public float setUpperLimit(float upperLimit){ public float setUpperLimit(float upperLimit){
@@ -132,11 +145,10 @@ public class CaveDustConfig extends JsonFile {
try { try {
return (ParticleEffect) Registries.PARTICLE_TYPE.get(new Identifier(Registries.PARTICLE_TYPE.getEntry(getParticleID()).get().getKey().get().getValue().toString().toLowerCase())); return (ParticleEffect) Registries.PARTICLE_TYPE.get(new Identifier(Registries.PARTICLE_TYPE.getEntry(getParticleID()).get().getKey().get().getValue().toString().toLowerCase()));
} catch (ClassCastException e) { } catch (ClassCastException e) {
MinecraftClient.getInstance().player.sendMessage(Text.translatable("debug.cavedust.particleerror"), true); MinecraftClient.getInstance().player.sendMessage(Text.literal("Issue loading particle, defaulting to white ash particle!"), false);
LOGGER.error("Cannot spawn particle, check config."); setParticleID(WHITE_ASH_ID);
iterateParticle();
save(); save();
return getParticle(); return ParticleTypes.WHITE_ASH;
} }
} }
@@ -198,15 +210,15 @@ public class CaveDustConfig extends JsonFile {
} }
public void resetConfig(){ public void resetConfig(){
width = 10; dimensionX = 5;
height = 10; dimensionY = 5;
dimensionZ = 5;
upperLimit = 64; upperLimit = 64;
lowerLimit = -64; lowerLimit = -64;
particleMultiplier = 1; particleMultiplier = 1;
particleMultiplierMultiplier = 10; particleMultiplierMultiplier = 10;
velocityRandomness = 0;
seaLevelCheck = true; seaLevelCheck = true;
caveDustEnabled = true; caveDustEnabled = true;

View File

@@ -1,54 +0,0 @@
package net.lizistired.cavedust;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.particle.*;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.DefaultParticleType;
public class CaveDustParticleFactory extends SpriteBillboardParticle {
private final SpriteProvider spriteProvider;
CaveDustParticleFactory(ClientWorld clientWorld, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) {
super(clientWorld, x, y, z);
this.spriteProvider = spriteProvider; //Sets the sprite provider from above to the sprite provider in the constructor method
this.maxAge = 200; //20 ticks = 1 second
this.scale = 0.1f;
this.velocityX = velocityX; //The velX from the constructor parameters
this.velocityY = -0.007f; //Allows the particle to slowly fall
this.velocityZ = velocityZ;
this.x = x; //The x from the constructor parameters
this.y = y;
this.z = z;
this.collidesWithWorld = true;
this.alpha = 1.0f; //Setting the alpha to 1.0f means there will be no opacity change until the alpha value is changed
this.setSpriteForAge(spriteProvider); //Required
}
@Override
public void tick() {
super.tick();
if(this.alpha < 0.0f){
this.markDead();
}
this.alpha -= 0.005f;
}
@Override
public ParticleTextureSheet getType() {
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
}
@Environment(EnvType.CLIENT)
public static class Factory implements ParticleFactory<DefaultParticleType> {
private final SpriteProvider spriteProvider;
public Factory(SpriteProvider spriteProvider) {
this.spriteProvider = spriteProvider;
}
public Particle createParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
return new CaveDustParticleFactory(world, x, y, z, velocityX, velocityY, velocityZ, this.spriteProvider);
}
}
}

View File

@@ -1,19 +0,0 @@
package net.lizistired.cavedust;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes;
import net.minecraft.particle.DefaultParticleType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
public class CaveDustServer implements ModInitializer {
public static final DefaultParticleType CAVE_DUST = FabricParticleTypes.simple();
/**
* Runs the mod initializer.
*/
@Override
public void onInitialize() {
Registry.register(Registries.PARTICLE_TYPE, new Identifier("cavedust", "cave_dust"), CAVE_DUST);
}
}

View File

@@ -3,14 +3,13 @@ package net.lizistired.cavedust;
import com.minelittlepony.common.client.gui.GameGui; import com.minelittlepony.common.client.gui.GameGui;
import com.minelittlepony.common.client.gui.element.*; import com.minelittlepony.common.client.gui.element.*;
import net.lizistired.cavedust.utils.TranslatableTextHelper; import net.lizistired.cavedust.utils.TranslatableTextHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.NoSuchElementException;
public class ModMenuConfigScreen extends GameGui { public class ModMenuConfigScreen extends GameGui {
public ModMenuConfigScreen(@Nullable Screen parent) { public ModMenuConfigScreen(@Nullable Screen parent) {
super(Text.translatable("menu.cavedust.title"), parent); super(Text.translatable("menu.cavedust.title"), parent);
@@ -73,15 +72,20 @@ public class ModMenuConfigScreen extends GameGui {
})).getStyle().setText("Particle: " + (getNameOfParticle())) })).getStyle().setText("Particle: " + (getNameOfParticle()))
.setTooltip(Text.translatable("menu.cavedust.particle.tooltip")); .setTooltip(Text.translatable("menu.cavedust.particle.tooltip"));
addButton(new Slider(left += 220, row -= 96, 1, 50, config.getDimensionWidth())) addButton(new Slider(left += 220, row -= 96, 1, 50, config.getDimensionsX()))
.onChange(config::setDimensionWidth) .onChange(config::setDimensionsX)
.setTextFormat(transText::formatMaxWidth) .setTextFormat(transText::formatMaxX)
.getStyle().setTooltip(Text.translatable("menu.cavedust.width.tooltip")); .getStyle().setTooltip(Text.translatable("menu.cavedust.X.tooltip"));
addButton(new Slider(left, row += 24, 1, 50, config.getDimensionHeight())) addButton(new Slider(left, row += 24, 1, 50, config.getDimensionsY()))
.onChange(config::setDimensionHeight) .onChange(config::setDimensionsY)
.setTextFormat(transText::formatMaxHeight) .setTextFormat(transText::formatMaxY)
.getStyle().setTooltip(Text.translatable("menu.cavedust.height.tooltip")); .getStyle().setTooltip(Text.translatable("menu.cavedust.Y.tooltip"));
addButton(new Slider(left, row += 24, 1, 50, config.getDimensionsZ()))
.onChange(config::setDimensionsZ)
.setTextFormat(transText::formatMaxZ)
.getStyle().setTooltip(Text.translatable("menu.cavedust.Z.tooltip"));
addButton(new Slider(left, row += 24, 0, 10, config.getVelocityRandomness())) addButton(new Slider(left, row += 24, 0, 10, config.getVelocityRandomness()))
.onChange(config::setVelocityRandomness) .onChange(config::setVelocityRandomness)
@@ -89,10 +93,9 @@ public class ModMenuConfigScreen extends GameGui {
.getStyle().setTooltip(Text.translatable("menu.cavedust.velocityrandomness.tooltip")); .getStyle().setTooltip(Text.translatable("menu.cavedust.velocityrandomness.tooltip"));
addButton(new Button(left -= 110, row += 120).onClick(sender -> { addButton(new Button(left -= 110, row += 60).onClick(sender -> {
config.resetConfig(); config.resetConfig();
finish(); finish();
client.setScreen(new ModMenuConfigScreen(parent));
})).getStyle().setText(Text.translatable("menu.cavedust.reset")).setTooltip(Text.translatable("menu.cavedust.reset.tooltip")); })).getStyle().setText(Text.translatable("menu.cavedust.reset")).setTooltip(Text.translatable("menu.cavedust.reset.tooltip"));
addButton(new Button(left, row += 24) addButton(new Button(left, row += 24)
@@ -103,17 +106,13 @@ public class ModMenuConfigScreen extends GameGui {
@Override @Override
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
renderBackground(context, mouseX, mouseY, partialTicks); renderBackground(matrices);
super.render(context, mouseX, mouseY, partialTicks); super.render(matrices, mouseX, mouseY, partialTicks);
} }
private String getNameOfParticle(){ private String getNameOfParticle(){
CaveDustConfig config = CaveDust.getInstance().getConfig(); CaveDustConfig config = CaveDust.getInstance().getConfig();
config.load(); config.load();
try {
return Registries.PARTICLE_TYPE.getEntry(config.getParticleID()).get().getKey().get().getValue().toString(); return Registries.PARTICLE_TYPE.getEntry(config.getParticleID()).get().getKey().get().getValue().toString();
} catch (NoSuchElementException e){
return "null";
}
} }
} }

View File

@@ -14,7 +14,7 @@ import static net.lizistired.cavedust.utils.ParticleSpawnUtil.shouldParticlesSpa
@Mixin(DebugHud.class) @Mixin(DebugHud.class)
public abstract class MixinDebugScreenOverlay { public abstract class MixinDebugScreenOverlay {
@Inject(method = "getRightText", at = @At("RETURN")) @Inject(method = "getRightText", at = @At("RETURN"))
private void appendDebugText(CallbackInfoReturnable<List<String>> cir) { private void appendShaderPackText(CallbackInfoReturnable<List<String>> cir) {
List<String> messages = cir.getReturnValue(); List<String> messages = cir.getReturnValue();
messages.add(""); messages.add("");

View File

@@ -35,10 +35,6 @@ public class MathHelper {
* @return Random number (double) * @return Random number (double)
*/ */
public static double generateRandomDouble(double min, double max) { public static double generateRandomDouble(double min, double max) {
try {
return ThreadLocalRandom.current().nextDouble(min, max); return ThreadLocalRandom.current().nextDouble(min, max);
} catch (IllegalArgumentException e) {
return 0;
}
} }
} }

View File

@@ -14,7 +14,6 @@ public class ParticleSpawnUtil {
private static float timer; private static float timer;
public static boolean shouldParticlesSpawn; public static boolean shouldParticlesSpawn;
/** /**
* Returns true if particles should spawn. * Returns true if particles should spawn.
* @param client MinecraftClient * @param client MinecraftClient
@@ -68,7 +67,6 @@ public class ParticleSpawnUtil {
|| client.world == null || client.world == null
|| !client.world.getDimension().bedWorks() || !client.world.getDimension().bedWorks()
|| (client.world.getBottomY() > pos.getY()) || (client.world.getBottomY() > pos.getY())
//|| client.world.getBiome(Objects.requireNonNull(pos)).matchesKey(LUSH_CAVES))
|| client.world.getBiome(Objects.requireNonNull(pos)).matchesKey(LUSH_CAVES)) || client.world.getBiome(Objects.requireNonNull(pos)).matchesKey(LUSH_CAVES))
{ {

View File

@@ -6,11 +6,14 @@ import net.minecraft.text.Text;
import javax.swing.*; import javax.swing.*;
public class TranslatableTextHelper { public class TranslatableTextHelper {
public Text formatMaxWidth(AbstractSlider<Float> slider) { public Text formatMaxX(AbstractSlider<Float> slider) {
return Text.translatable("menu.cavedust.width", (int)Math.floor(slider.getValue())); return Text.translatable("menu.cavedust.X", (int)Math.floor(slider.getValue()));
} }
public Text formatMaxHeight(AbstractSlider<Float> slider) { public Text formatMaxY(AbstractSlider<Float> slider) {
return Text.translatable("menu.cavedust.height", (int)Math.floor(slider.getValue())); return Text.translatable("menu.cavedust.Y", (int)Math.floor(slider.getValue()));
}
public Text formatMaxZ(AbstractSlider<Float> slider) {
return Text.translatable("menu.cavedust.Z", (int)Math.floor(slider.getValue()));
} }
public Text formatUpperLimit(AbstractSlider<Float> slider) { public Text formatUpperLimit(AbstractSlider<Float> slider) {
return Text.translatable("menu.cavedust.upperlimit", (int)Math.floor(slider.getValue())); return Text.translatable("menu.cavedust.upperlimit", (int)Math.floor(slider.getValue()));

View File

@@ -1,5 +0,0 @@
{
"textures": [
"minecraft:generic_0"
]
}

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

@@ -4,10 +4,12 @@
"menu.cavedust.global.true": "Cave Dust: Enabled", "menu.cavedust.global.true": "Cave Dust: Enabled",
"menu.cavedust.global.tooltip.false": "Enable cave dust particles?", "menu.cavedust.global.tooltip.false": "Enable cave dust particles?",
"menu.cavedust.global.tooltip.true": "Disable cave dust particles?", "menu.cavedust.global.tooltip.true": "Disable cave dust particles?",
"menu.cavedust.width": "Width bounds: %s", "menu.cavedust.X": "X bounds: %s",
"menu.cavedust.height": "Height bounds: %s", "menu.cavedust.Y": "Y bounds: %s",
"menu.cavedust.width.tooltip": "Maximum width to spawn particle.", "menu.cavedust.Z": "Z bounds: %s",
"menu.cavedust.height.tooltip": "Maximum height to spawn particle.", "menu.cavedust.X.tooltip": "X axis bounds for particle spawning.",
"menu.cavedust.Y.tooltip": "Y axis bounds for particle spawning.",
"menu.cavedust.Z.tooltip": "Z axis bounds for particle spawning.",
"menu.cavedust.upperlimit": "Upper limit height: %s", "menu.cavedust.upperlimit": "Upper limit height: %s",
"menu.cavedust.lowerlimit": "Lower limit height: %s", "menu.cavedust.lowerlimit": "Lower limit height: %s",
"menu.cavedust.upperlimit.tooltip": "The height where particles will fade out and stop spawning (uses player y).", "menu.cavedust.upperlimit.tooltip": "The height where particles will fade out and stop spawning (uses player y).",
@@ -35,7 +37,6 @@
"debug.cavedust.toggle.true": "(Cave Dust) Enabled particles", "debug.cavedust.toggle.true": "(Cave Dust) Enabled particles",
"debug.cavedust.toggle.false": "(Cave Dust) Disabled particles", "debug.cavedust.toggle.false": "(Cave Dust) Disabled particles",
"debug.cavedust.reload": "(Cave Dust) Reloaded config", "debug.cavedust.reload": "(Cave Dust) Reloaded config"
"debug.cavedust.particleerror": "(Cave Dust) Error setting particle, skipping to next particle!"
} }

View File

@@ -12,14 +12,12 @@
"sources": "https://github.com/LizIsTired/dust" "sources": "https://github.com/LizIsTired/dust"
}, },
"license": "MPL-2.0", "license": "MPL-2.0",
"icon": "assets/cavedust/icon.png", "icon": "assets/modid/icon.png",
"environment": "*", "environment": "*",
"entrypoints": { "entrypoints": {
"client": [ "client": [
"net.lizistired.cavedust.CaveDust" "net.lizistired.cavedust.CaveDust"
], ],
"main": [
"net.lizistired.cavedust.CaveDustServer"],
"modmenu": [ "modmenu": [
"net.lizistired.cavedust.CaveDustModMenuFactory" "net.lizistired.cavedust.CaveDustModMenuFactory"
] ]
@@ -30,7 +28,7 @@
"depends": { "depends": {
"fabricloader": ">=0.14.5", "fabricloader": ">=0.14.5",
"fabric": "*", "fabric": "*",
"minecraft": "1.20.4", "minecraft": ">=1.19-beta.5",
"java": ">=17" "java": ">=17"
}, },
"suggests": { "suggests": {