Compare commits
17 Commits
1.20.1_fab
...
1.21.4_fab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c709bb4a4b | ||
|
|
b3f79db8e2 | ||
|
|
db9040acc5 | ||
|
|
be27cf0f30 | ||
|
|
734ea7a1a2 | ||
|
|
71832342af | ||
|
|
4b4b2ad206 | ||
|
|
e795778ba8 | ||
|
|
99ffeb1f99 | ||
|
|
4e1a122289 | ||
|
|
2161bbd1ba | ||
|
|
e35fdaa8ce | ||
|
|
a0aef4a5ef | ||
|
|
39cf0a0703 | ||
|
|
22928e4885 | ||
|
|
8cb6407f8b | ||
|
|
1a097e6daf |
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -24,12 +24,12 @@ jobs:
|
|||||||
- name: Extract current branch name
|
- name: Extract current branch name
|
||||||
shell: bash
|
shell: bash
|
||||||
# bash pattern expansion to grab branch name without slashes
|
# bash pattern expansion to grab branch name without slashes
|
||||||
run: ref="${GITHUB_REF#refs/heads/}" && echo "::set-output name=branch::${ref////-}"
|
run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT
|
||||||
id: ref
|
id: ref
|
||||||
|
|
||||||
- name: Set outputs
|
- name: Set outputs
|
||||||
id: vars
|
id: vars
|
||||||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
- name: Check outputs
|
- name: Check outputs
|
||||||
run: echo ${{ steps.vars.outputs.sha_short }}
|
run: echo ${{ steps.vars.outputs.sha_short }}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
id 'fabric-loom' version '1.8-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
archivesBaseName = project.archives_base_name
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
@@ -61,7 +58,7 @@ processResources {
|
|||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
||||||
it.options.release = 17
|
it.options.release = 21
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
@@ -69,6 +66,8 @@ java {
|
|||||||
// if it is present.
|
// if it is present.
|
||||||
// If you remove this line, sources will not be generated.
|
// If you remove this line, sources will not be generated.
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
|
targetCompatibility = JavaVersion.VERSION_21
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ 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.1
|
minecraft_version=1.21.4
|
||||||
yarn_mappings=1.20.1+build.10
|
yarn_mappings=1.21.4+build.8
|
||||||
loader_version=0.15.11
|
loader_version=0.16.10
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=3.0.1
|
mod_version=3.0.1
|
||||||
@@ -13,7 +13,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
archives_base_name=cave_dust
|
archives_base_name=cave_dust
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.92.2+1.20.1
|
fabric_version=0.114.0+1.21.4
|
||||||
clothconfig_version=11.1.118
|
clothconfig_version=17.0.144
|
||||||
modmenu_version=7.2.2
|
modmenu_version=13.0.0
|
||||||
kirin_version=1.15.6+1.20.1
|
kirin_version=1.20.3+1.21.4
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
24
gradlew
vendored
24
gradlew
vendored
@@ -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/HEAD/platforms/jvm/plugins-application/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/.
|
||||||
@@ -83,7 +83,8 @@ done
|
|||||||
# This is normally unused
|
# This is normally unused
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
# 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
|
||||||
@@ -130,10 +131,13 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
@@ -141,7 +145,7 @@ 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.
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC2039,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
|
||||||
@@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC2039,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
|
||||||
@@ -198,11 +202,11 @@ fi
|
|||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# 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"'
|
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, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
# and any embedded shellness will be escaped.
|
||||||
# double quotes to make sure that they get re-expanded; and
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
|||||||
20
gradlew.bat
vendored
20
gradlew.bat
vendored
@@ -43,11 +43,11 @@ 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% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
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. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,10 @@ package net.lizistired.cavedust;
|
|||||||
|
|
||||||
//minecraft imports
|
//minecraft imports
|
||||||
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
|
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.ParticleEffect;
|
import net.minecraft.particle.ParticleEffect;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -42,10 +41,13 @@ public class CaveDust implements ClientModInitializer {
|
|||||||
public net.lizistired.cavedust.CaveDustConfig getConfig() {
|
public net.lizistired.cavedust.CaveDustConfig getConfig() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ParticleEffect WHITE_ASH_ID = (ParticleEffect) Registries.PARTICLE_TYPE.get(Identifier.of("cavedust", "cave_dust"));
|
public static ParticleEffect WHITE_ASH_ID = (ParticleEffect) Registries.PARTICLE_TYPE.get(Identifier.of("cavedust", "cave_dust"));
|
||||||
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
|
||||||
@@ -54,6 +56,7 @@ public class CaveDust implements ClientModInitializer {
|
|||||||
config.load();
|
config.load();
|
||||||
registerKeyBindings();
|
registerKeyBindings();
|
||||||
ParticleFactoryRegistry.getInstance().register(CaveDustServer.CAVE_DUST, CaveDustParticleFactory.Factory::new);
|
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);
|
||||||
}
|
}
|
||||||
@@ -73,13 +76,13 @@ public class CaveDust implements ClientModInitializer {
|
|||||||
//ensure world is not null
|
//ensure world is not null
|
||||||
if (client.world == null) return;
|
if (client.world == null) return;
|
||||||
World world = client.world;
|
World world = client.world;
|
||||||
|
|
||||||
//LOGGER.info(String.valueOf(((ClientWorldAccessor) client.world.getLevelProperties()).getFlatWorld()));
|
//LOGGER.info(String.valueOf(((ClientWorldAccessor) client.world.getLevelProperties()).getFlatWorld()));
|
||||||
// )
|
// )
|
||||||
double probabilityNormalized = normalize(config.getLowerLimit(), config.getUpperLimit(), client.player.getBlockY());
|
double probabilityNormalized = normalize(config.getLowerLimit(), config.getUpperLimit(), client.player.getBlockY());
|
||||||
PARTICLE_AMOUNT = (int) (probabilityNormalized * config.getParticleMultiplier() * config.getParticleMultiplierMultiplier());
|
PARTICLE_AMOUNT = (int) (probabilityNormalized * config.getParticleMultiplier() * config.getParticleMultiplierMultiplier());
|
||||||
|
|
||||||
for (int i = 0; i < PARTICLE_AMOUNT; i++) {
|
for (int i = 0; i < PARTICLE_AMOUNT; i++) {
|
||||||
try {
|
|
||||||
int x = (int) (client.player.getPos().getX() + (int) generateRandomDouble(config.getDimensionWidth() *-1, config.getDimensionWidth()));
|
int x = (int) (client.player.getPos().getX() + (int) generateRandomDouble(config.getDimensionWidth() *-1, config.getDimensionWidth()));
|
||||||
int y = (int) (client.player.getEyePos().getY() + (int) generateRandomDouble(config.getDimensionHeight() *-1, config.getDimensionHeight()));
|
int y = (int) (client.player.getEyePos().getY() + (int) generateRandomDouble(config.getDimensionHeight() *-1, config.getDimensionHeight()));
|
||||||
int z = (int) (client.player.getPos().getZ() + (int) generateRandomDouble(config.getDimensionWidth() *-1, config.getDimensionWidth()));
|
int z = (int) (client.player.getPos().getZ() + (int) generateRandomDouble(config.getDimensionWidth() *-1, config.getDimensionWidth()));
|
||||||
@@ -90,14 +93,9 @@ public class CaveDust implements ClientModInitializer {
|
|||||||
|
|
||||||
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(getConfig().getParticle(), miniX, miniY, miniZ, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) {
|
|
||||||
LOGGER.error(String.valueOf(e));
|
|
||||||
//getConfig().setParticleID(WHITE_ASH_ID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,12 +2,9 @@ package net.lizistired.cavedust;
|
|||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.lizistired.cavedust.utils.MathHelper;
|
|
||||||
import net.minecraft.client.particle.*;
|
import net.minecraft.client.particle.*;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.particle.DefaultParticleType;
|
import net.minecraft.particle.SimpleParticleType;
|
||||||
import net.minecraft.particle.ParticleEffect;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class CaveDustParticleFactory extends SpriteBillboardParticle {
|
public class CaveDustParticleFactory extends SpriteBillboardParticle {
|
||||||
private final SpriteProvider spriteProvider;
|
private final SpriteProvider spriteProvider;
|
||||||
@@ -15,6 +12,7 @@ public class CaveDustParticleFactory extends SpriteBillboardParticle {
|
|||||||
super(clientWorld, x, y, z);
|
super(clientWorld, x, y, z);
|
||||||
this.spriteProvider = spriteProvider; //Sets the sprite provider from above to the sprite provider in the constructor method
|
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.maxAge = 200; //20 ticks = 1 second
|
||||||
|
this.scale = 0.1f;
|
||||||
this.velocityX = velocityX; //The velX from the constructor parameters
|
this.velocityX = velocityX; //The velX from the constructor parameters
|
||||||
this.velocityY = -0.007f; //Allows the particle to slowly fall
|
this.velocityY = -0.007f; //Allows the particle to slowly fall
|
||||||
this.velocityZ = velocityZ;
|
this.velocityZ = velocityZ;
|
||||||
@@ -41,7 +39,7 @@ public class CaveDustParticleFactory extends SpriteBillboardParticle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public static class Factory implements ParticleFactory<DefaultParticleType> {
|
public static class Factory implements ParticleFactory<SimpleParticleType> {
|
||||||
private final SpriteProvider spriteProvider;
|
private final SpriteProvider spriteProvider;
|
||||||
|
|
||||||
public Factory(SpriteProvider spriteProvider) {
|
public Factory(SpriteProvider spriteProvider) {
|
||||||
@@ -49,8 +47,7 @@ public class CaveDustParticleFactory extends SpriteBillboardParticle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
public Particle createParticle(SimpleParticleType type, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
|
||||||
public @Nullable Particle createParticle(DefaultParticleType parameters, 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);
|
return new CaveDustParticleFactory(world, x, y, z, velocityX, velocityY, velocityZ, this.spriteProvider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,18 @@ package net.lizistired.cavedust;
|
|||||||
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes;
|
import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes;
|
||||||
import net.minecraft.particle.DefaultParticleType;
|
import net.minecraft.particle.SimpleParticleType;
|
||||||
import net.minecraft.particle.ParticleEffect;
|
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class CaveDustServer implements ModInitializer {
|
public class CaveDustServer implements ModInitializer {
|
||||||
public static final DefaultParticleType CAVE_DUST = FabricParticleTypes.simple();
|
public static final SimpleParticleType CAVE_DUST = FabricParticleTypes.simple();
|
||||||
/**
|
/**
|
||||||
* Runs the mod initializer.
|
* Runs the mod initializer.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
Registry.register(Registries.PARTICLE_TYPE, new Identifier("cavedust", "cave_dust"), CAVE_DUST);
|
Registry.register(Registries.PARTICLE_TYPE, Identifier.of("cavedust", "cave_dust"), CAVE_DUST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import net.minecraft.client.gui.screen.Screen;
|
|||||||
import net.minecraft.particle.ParticleType;
|
import net.minecraft.particle.ParticleType;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
@@ -77,13 +76,13 @@ public class ModMenuConfigScreen extends GameGui {
|
|||||||
|
|
||||||
addButton(new Slider(left += 220, row -= 96, 1, 50, config.getDimensionWidth()))
|
addButton(new Slider(left += 220, row -= 96, 1, 50, config.getDimensionWidth()))
|
||||||
.onChange(config::setDimensionWidth)
|
.onChange(config::setDimensionWidth)
|
||||||
.setTextFormat(transText::formatMaxX)
|
.setTextFormat(transText::formatMaxWidth)
|
||||||
.getStyle().setTooltip(Text.translatable("menu.cavedust.X.tooltip"));
|
.getStyle().setTooltip(Text.translatable("menu.cavedust.width.tooltip"));
|
||||||
|
|
||||||
addButton(new Slider(left, row += 24, 1, 50, config.getDimensionHeight()))
|
addButton(new Slider(left, row += 24, 1, 50, config.getDimensionHeight()))
|
||||||
.onChange(config::setDimensionHeight)
|
.onChange(config::setDimensionHeight)
|
||||||
.setTextFormat(transText::formatMaxY)
|
.setTextFormat(transText::formatMaxHeight)
|
||||||
.getStyle().setTooltip(Text.translatable("menu.cavedust.Y.tooltip"));
|
.getStyle().setTooltip(Text.translatable("menu.cavedust.height.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)
|
||||||
@@ -106,18 +105,18 @@ public class ModMenuConfigScreen extends GameGui {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
|
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
|
||||||
renderBackground(context);
|
renderBackground(context, mouseX, mouseY, partialTicks);
|
||||||
super.render(context, mouseX, mouseY, partialTicks);
|
super.render(context, mouseX, mouseY, partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Identifier getNameOfParticle(){
|
private String getNameOfParticle(){
|
||||||
CaveDustConfig config = CaveDust.getInstance().getConfig();
|
CaveDustConfig config = CaveDust.getInstance().getConfig();
|
||||||
config.load();
|
config.load();
|
||||||
try {
|
try {
|
||||||
return Registries.PARTICLE_TYPE.getId((ParticleType<?>) config.getParticleID());
|
return Registries.PARTICLE_TYPE.getEntry((ParticleType<?>) config.getParticleID()).getIdAsString();
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e){
|
||||||
CaveDust.LOGGER.error(String.valueOf(e));
|
CaveDust.LOGGER.error(String.valueOf(e));
|
||||||
return null;
|
return "null";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ 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
|
||||||
@@ -67,6 +68,7 @@ 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))
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,13 +3,11 @@ package net.lizistired.cavedust.utils;
|
|||||||
import com.minelittlepony.common.client.gui.element.AbstractSlider;
|
import com.minelittlepony.common.client.gui.element.AbstractSlider;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
public class TranslatableTextHelper {
|
public class TranslatableTextHelper {
|
||||||
public Text formatMaxX(AbstractSlider<Float> slider) {
|
public Text formatMaxWidth(AbstractSlider<Float> slider) {
|
||||||
return Text.translatable("menu.cavedust.width", (int)Math.floor(slider.getValue()));
|
return Text.translatable("menu.cavedust.width", (int)Math.floor(slider.getValue()));
|
||||||
}
|
}
|
||||||
public Text formatMaxY(AbstractSlider<Float> slider) {
|
public Text formatMaxHeight(AbstractSlider<Float> slider) {
|
||||||
return Text.translatable("menu.cavedust.height", (int)Math.floor(slider.getValue()));
|
return Text.translatable("menu.cavedust.height", (int)Math.floor(slider.getValue()));
|
||||||
}
|
}
|
||||||
public Text formatUpperLimit(AbstractSlider<Float> slider) {
|
public Text formatUpperLimit(AbstractSlider<Float> slider) {
|
||||||
@@ -28,12 +26,4 @@ public class TranslatableTextHelper {
|
|||||||
public Text formatVelocityRandomness(AbstractSlider<Float> slider) {
|
public Text formatVelocityRandomness(AbstractSlider<Float> slider) {
|
||||||
return Text.translatable("menu.cavedust.velocityrandomness", (int) Math.floor(slider.getValue()));
|
return Text.translatable("menu.cavedust.velocityrandomness", (int) Math.floor(slider.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text formatScaleLower(AbstractSlider<Float> slider) {
|
|
||||||
return Text.translatable("menu.cavedust.scalelower", (int) Math.floor(slider.getValue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Text formatScaleHigher(AbstractSlider<Float> slider) {
|
|
||||||
return Text.translatable("menu.cavedust.scalehigher", (int) Math.floor(slider.getValue()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"modmenu.descriptionTranslation.cavedust": "Makes dust underground that scales with depth!",
|
||||||
"menu.cavedust.title": "Cave Dust",
|
"menu.cavedust.title": "Cave Dust",
|
||||||
"menu.cavedust.global.false": "Cave Dust: Disabled",
|
"menu.cavedust.global.false": "Cave Dust: Disabled",
|
||||||
"menu.cavedust.global.true": "Cave Dust: Enabled",
|
"menu.cavedust.global.true": "Cave Dust: Enabled",
|
||||||
@@ -28,10 +29,6 @@
|
|||||||
"menu.cavedust.superflatstatus.tooltip": "Should particles spawn on superflat worlds?",
|
"menu.cavedust.superflatstatus.tooltip": "Should particles spawn on superflat worlds?",
|
||||||
"menu.cavedust.particle": "Particle: ",
|
"menu.cavedust.particle": "Particle: ",
|
||||||
"menu.cavedust.particle.tooltip": "Particle to spawn. Click to cycle.",
|
"menu.cavedust.particle.tooltip": "Particle to spawn. Click to cycle.",
|
||||||
"menu.cavedust.scalelower": "Minimum scale: %s",
|
|
||||||
"menu.cavedust.scalelower.tooltip": "Minimum particle size to spawn.",
|
|
||||||
"menu.cavedust.scalehigher": "Maximum scale: %s",
|
|
||||||
"menu.cavedust.scalehigher.tooltip": "Maximum particle size to spawn.",
|
|
||||||
|
|
||||||
"key.cavedust.reload": "Reload Config",
|
"key.cavedust.reload": "Reload Config",
|
||||||
"key.cavedust.toggle": "Toggle Particles",
|
"key.cavedust.toggle": "Toggle Particles",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"modmenu.descriptionTranslation.cavedust": "在地下生成随深度增加而变化的尘埃!",
|
||||||
"menu.cavedust.title": "洞穴尘埃",
|
"menu.cavedust.title": "洞穴尘埃",
|
||||||
"menu.cavedust.global.false": "洞穴尘埃: 功能启用",
|
"menu.cavedust.global.false": "洞穴尘埃: 功能启用",
|
||||||
"menu.cavedust.global.true": "洞穴尘埃: 功能禁用",
|
"menu.cavedust.global.true": "洞穴尘埃: 功能禁用",
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
"net.lizistired.cavedust.CaveDust"
|
"net.lizistired.cavedust.CaveDust"
|
||||||
],
|
],
|
||||||
"main": [
|
"main": [
|
||||||
"net.lizistired.cavedust.CaveDustServer"
|
"net.lizistired.cavedust.CaveDustServer"],
|
||||||
],
|
|
||||||
"modmenu": [
|
"modmenu": [
|
||||||
"net.lizistired.cavedust.CaveDustModMenuFactory"
|
"net.lizistired.cavedust.CaveDustModMenuFactory"
|
||||||
]
|
]
|
||||||
@@ -31,7 +30,7 @@
|
|||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.14.5",
|
"fabricloader": ">=0.14.5",
|
||||||
"fabric": "*",
|
"fabric": "*",
|
||||||
"minecraft": "1.20.1",
|
"minecraft": "1.21.4",
|
||||||
"java": ">=17"
|
"java": ">=17"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
|
|||||||
Reference in New Issue
Block a user