Compare commits
1 Commits
1.21.10_fa
...
1.21_fabri
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02f28c9fbf |
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.11-SNAPSHOT'
|
id 'fabric-loom' version '1.8-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,18 @@
|
|||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
minecraft_version=1.21.10
|
# check these on https://fabricmc.net/develop
|
||||||
yarn_mappings=1.21.10+build.3
|
minecraft_version=1.21.1
|
||||||
loader_version=0.18.4
|
yarn_mappings=1.21.1+build.3
|
||||||
loom_version=1.14-SNAPSHOT
|
loader_version=0.16.9
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.0.0
|
mod_version=3.0.1
|
||||||
maven_group=com.straice
|
maven_group=com.lizistired
|
||||||
archives_base_name=cave_dust_reforged
|
archives_base_name=cave_dust
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.138.4+1.21.10
|
fabric_version=0.114.0+1.21.1
|
||||||
modmenu_version=16.0.0-rc.2
|
clothconfig_version=15.0.140
|
||||||
kirin_version=1.21.3+1.21.10
|
modmenu_version=11.0.3
|
||||||
|
kirin_version=1.20.0+1.21
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
5
gradlew
vendored
5
gradlew
vendored
@@ -15,8 +15,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@@ -86,8 +84,7 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
' "$PWD" ) || 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
|
||||||
|
|||||||
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@@ -13,8 +13,6 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
@rem SPDX-License-Identifier: Apache-2.0
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|||||||
@@ -1,129 +1,101 @@
|
|||||||
package net.lizistired.cavedust;
|
package net.lizistired.cavedust;
|
||||||
|
|
||||||
// minecraft imports
|
//minecraft imports
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
|
||||||
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
|
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.particle.ParticleEffect;
|
import net.minecraft.particle.ParticleEffect;
|
||||||
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;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
//other imports
|
||||||
// other imports
|
|
||||||
import com.minelittlepony.common.util.GamePaths;
|
import com.minelittlepony.common.util.GamePaths;
|
||||||
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
//java imports
|
||||||
// java imports
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
//static imports
|
||||||
// static imports
|
import static net.lizistired.cavedust.utils.MathHelper.*;
|
||||||
import static net.lizistired.cavedust.utils.KeybindingHelper.*;
|
|
||||||
import static net.lizistired.cavedust.utils.MathHelper.generateRandomDouble;
|
import static net.lizistired.cavedust.utils.MathHelper.generateRandomDouble;
|
||||||
import static net.lizistired.cavedust.utils.MathHelper.normalize;
|
|
||||||
import static net.lizistired.cavedust.utils.ParticleSpawnUtil.shouldParticlesSpawn;
|
import static net.lizistired.cavedust.utils.ParticleSpawnUtil.shouldParticlesSpawn;
|
||||||
|
import static net.lizistired.cavedust.utils.KeybindingHelper.*;
|
||||||
|
|
||||||
|
|
||||||
public class CaveDust implements ClientModInitializer {
|
public class CaveDust implements ClientModInitializer {
|
||||||
// logger
|
//logger
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger("cavedust");
|
public static final Logger LOGGER = LoggerFactory.getLogger("cavedust");
|
||||||
|
//make class static
|
||||||
|
private static CaveDust instance;
|
||||||
|
public static CaveDust getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
public CaveDust() {
|
||||||
|
instance = this;
|
||||||
|
}
|
||||||
|
//config assignment
|
||||||
|
private static net.lizistired.cavedust.CaveDustConfig config;
|
||||||
|
public net.lizistired.cavedust.CaveDustConfig getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
// make class static
|
public static ParticleEffect WHITE_ASH_ID = (ParticleEffect) Registries.PARTICLE_TYPE.get(Identifier.of("cavedust", "cave_dust"));
|
||||||
private static CaveDust instance;
|
public static int PARTICLE_AMOUNT = 0;
|
||||||
|
|
||||||
public static CaveDust getInstance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CaveDust() {
|
|
||||||
instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// config assignment
|
|
||||||
private static CaveDustConfig config;
|
|
||||||
|
|
||||||
public CaveDustConfig getConfig() {
|
@Override
|
||||||
return config;
|
public void onInitializeClient() {
|
||||||
}
|
//config path and loading
|
||||||
|
Path CaveDustFolder = GamePaths.getConfigDirectory().resolve("cavedust");
|
||||||
|
config = new CaveDustConfig(CaveDustFolder.getParent().resolve("cavedust.json"), this);
|
||||||
|
config.load();
|
||||||
|
registerKeyBindings();
|
||||||
|
ParticleFactoryRegistry.getInstance().register(CaveDustServer.CAVE_DUST, CaveDustParticleFactory.Factory::new);
|
||||||
|
|
||||||
public static ParticleEffect WHITE_ASH_ID =
|
//register end client tick to create cave dust function, using end client tick for async
|
||||||
(ParticleEffect) Registries.PARTICLE_TYPE.get(Identifier.of("cavedust", "cave_dust"));
|
ClientTickEvents.END_CLIENT_TICK.register(this::createCaveDust);
|
||||||
|
}
|
||||||
|
|
||||||
public static int PARTICLE_AMOUNT = 0;
|
private void createCaveDust(MinecraftClient client) {
|
||||||
|
if (keyBinding1.wasPressed()){
|
||||||
|
getConfig().toggleCaveDust();
|
||||||
|
LOGGER.info("Toggled dust");
|
||||||
|
client.player.sendMessage(Text.translatable("debug.cavedust.toggle." + config.getCaveDustEnabled()), false);
|
||||||
|
}
|
||||||
|
if (keyBinding2.wasPressed()){
|
||||||
|
getConfig().load();
|
||||||
|
LOGGER.info("Reloaded config");
|
||||||
|
client.player.sendMessage(Text.translatable("debug.cavedust.reload"), false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
//ensure world is not null
|
||||||
public void onInitializeClient() {
|
if (client.world == null) return;
|
||||||
// config path and loading
|
World world = client.world;
|
||||||
Path caveDustFolder = GamePaths.getConfigDirectory().resolve("cavedust");
|
|
||||||
config = new CaveDustConfig(caveDustFolder.getParent().resolve("cavedust.json"), this);
|
|
||||||
config.load();
|
|
||||||
|
|
||||||
registerKeyBindings();
|
//LOGGER.info(String.valueOf(((ClientWorldAccessor) client.world.getLevelProperties()).getFlatWorld()));
|
||||||
|
// )
|
||||||
|
double probabilityNormalized = normalize(config.getLowerLimit(), config.getUpperLimit(), client.player.getBlockY());
|
||||||
|
PARTICLE_AMOUNT = (int) (probabilityNormalized * config.getParticleMultiplier() * config.getParticleMultiplierMultiplier());
|
||||||
|
|
||||||
ParticleFactoryRegistry.getInstance().register(CaveDustServer.CAVE_DUST, CaveDustParticleFactory.Factory::new);
|
for (int i = 0; i < PARTICLE_AMOUNT; i++) {
|
||||||
|
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 z = (int) (client.player.getPos().getZ() + (int) generateRandomDouble(config.getDimensionWidth() *-1, config.getDimensionWidth()));
|
||||||
|
double miniX = (x + Math.random());
|
||||||
|
double miniY = (y + Math.random());
|
||||||
|
double miniZ = (z + Math.random());
|
||||||
|
BlockPos particlePos = new BlockPos(x, y, z);
|
||||||
|
|
||||||
// register end client tick to create cave dust function, using end client tick for async
|
if (shouldParticlesSpawn(client, config, particlePos)) {
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(this::createCaveDust);
|
if (client.world.getBlockState(particlePos).isAir()) {
|
||||||
}
|
world.addParticle(getConfig().getParticle(), miniX, miniY, miniZ, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01, config.getVelocityRandomnessRandom() * 0.01);
|
||||||
|
}
|
||||||
private void createCaveDust(MinecraftClient client) {
|
}
|
||||||
if (client.player == null) return;
|
}
|
||||||
|
}
|
||||||
if (keyBinding1.wasPressed()) {
|
}
|
||||||
getConfig().toggleCaveDust();
|
|
||||||
LOGGER.info("Toggled dust");
|
|
||||||
client.player.sendMessage(
|
|
||||||
Text.translatable("debug.cavedust.toggle." + config.getCaveDustEnabled()),
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyBinding2.wasPressed()) {
|
|
||||||
getConfig().load();
|
|
||||||
LOGGER.info("Reloaded config");
|
|
||||||
client.player.sendMessage(Text.translatable("debug.cavedust.reload"), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure world is not null
|
|
||||||
if (client.world == null) return;
|
|
||||||
World world = client.world;
|
|
||||||
|
|
||||||
double probabilityNormalized =
|
|
||||||
normalize(config.getLowerLimit(), config.getUpperLimit(), client.player.getBlockY());
|
|
||||||
|
|
||||||
PARTICLE_AMOUNT = (int) (probabilityNormalized
|
|
||||||
* config.getParticleMultiplier()
|
|
||||||
* config.getParticleMultiplierMultiplier());
|
|
||||||
|
|
||||||
for (int i = 0; i < PARTICLE_AMOUNT; i++) {
|
|
||||||
int x = (int) (client.player.getX()
|
|
||||||
+ generateRandomDouble(-config.getDimensionWidth(), config.getDimensionWidth()));
|
|
||||||
|
|
||||||
int y = (int) (client.player.getEyeY()
|
|
||||||
+ generateRandomDouble(-config.getDimensionHeight(), config.getDimensionHeight()));
|
|
||||||
|
|
||||||
int z = (int) (client.player.getZ()
|
|
||||||
+ generateRandomDouble(-config.getDimensionWidth(), config.getDimensionWidth()));
|
|
||||||
|
|
||||||
double miniX = x + Math.random();
|
|
||||||
double miniY = y + Math.random();
|
|
||||||
double miniZ = z + Math.random();
|
|
||||||
|
|
||||||
BlockPos particlePos = new BlockPos(x, y, z);
|
|
||||||
|
|
||||||
if (shouldParticlesSpawn(client, config, particlePos)) {
|
|
||||||
if (client.world.getBlockState(particlePos).isAir()) {
|
|
||||||
world.addParticleClient(
|
|
||||||
getConfig().getParticle(),
|
|
||||||
miniX, miniY, miniZ,
|
|
||||||
config.getVelocityRandomnessRandom() * 0.01,
|
|
||||||
config.getVelocityRandomnessRandom() * 0.01,
|
|
||||||
config.getVelocityRandomnessRandom() * 0.01
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,63 +2,40 @@ 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.minecraft.client.particle.BillboardParticle;
|
import net.minecraft.client.particle.*;
|
||||||
import net.minecraft.client.particle.Particle;
|
|
||||||
import net.minecraft.client.particle.ParticleFactory;
|
|
||||||
import net.minecraft.client.particle.SpriteProvider;
|
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.particle.SimpleParticleType;
|
import net.minecraft.particle.SimpleParticleType;
|
||||||
import net.minecraft.util.math.random.Random;
|
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
public class CaveDustParticleFactory extends SpriteBillboardParticle {
|
||||||
public class CaveDustParticleFactory extends BillboardParticle {
|
|
||||||
private final SpriteProvider spriteProvider;
|
private final SpriteProvider spriteProvider;
|
||||||
|
CaveDustParticleFactory(ClientWorld clientWorld, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) {
|
||||||
CaveDustParticleFactory(
|
super(clientWorld, x, y, z);
|
||||||
ClientWorld world,
|
this.spriteProvider = spriteProvider; //Sets the sprite provider from above to the sprite provider in the constructor method
|
||||||
double x, double y, double z,
|
this.maxAge = 200; //20 ticks = 1 second
|
||||||
double velocityX, double velocityY, double velocityZ,
|
|
||||||
SpriteProvider spriteProvider
|
|
||||||
) {
|
|
||||||
// En 1.21.9+ BillboardParticle puede recibir sprite inicial
|
|
||||||
super(world, x, y, z, velocityX, velocityY, velocityZ, spriteProvider.getFirst());
|
|
||||||
|
|
||||||
this.spriteProvider = spriteProvider;
|
|
||||||
|
|
||||||
this.maxAge = 200; // 20 ticks = 1s
|
|
||||||
this.scale = 0.1f;
|
this.scale = 0.1f;
|
||||||
|
this.velocityX = velocityX; //The velX from the constructor parameters
|
||||||
this.velocityX = velocityX;
|
this.velocityY = -0.007f; //Allows the particle to slowly fall
|
||||||
this.velocityY = -0.007f;
|
|
||||||
this.velocityZ = velocityZ;
|
this.velocityZ = velocityZ;
|
||||||
|
this.x = x; //The x from the constructor parameters
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
this.collidesWithWorld = true;
|
this.collidesWithWorld = true;
|
||||||
this.alpha = 1.0f;
|
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
|
||||||
// Selecciona el sprite correcto según edad/maxAge (equivalente a setSpriteForAge)
|
|
||||||
this.updateSprite(spriteProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BillboardParticle.RenderType getRenderType() {
|
|
||||||
return BillboardParticle.RenderType.PARTICLE_ATLAS_TRANSLUCENT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
if(this.alpha < 0.0f){
|
||||||
if (!this.isAlive()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.alpha -= 0.005f;
|
|
||||||
if (this.alpha <= 0.0f) {
|
|
||||||
this.markDead();
|
this.markDead();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
this.alpha -= 0.005f;
|
||||||
|
}
|
||||||
|
|
||||||
this.updateSprite(this.spriteProvider);
|
@Override
|
||||||
|
public ParticleTextureSheet getType() {
|
||||||
|
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
@@ -69,14 +46,8 @@ public class CaveDustParticleFactory extends BillboardParticle {
|
|||||||
this.spriteProvider = spriteProvider;
|
this.spriteProvider = spriteProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Particle createParticle(
|
public Particle createParticle(SimpleParticleType type, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
|
||||||
SimpleParticleType type,
|
|
||||||
ClientWorld world,
|
|
||||||
double x, double y, double z,
|
|
||||||
double velocityX, double velocityY, double velocityZ,
|
|
||||||
Random random
|
|
||||||
) {
|
|
||||||
return new CaveDustParticleFactory(world, x, y, z, velocityX, velocityY, velocityZ, this.spriteProvider);
|
return new CaveDustParticleFactory(world, x, y, z, velocityX, velocityY, velocityZ, this.spriteProvider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ 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, mouseX, mouseY, partialTicks);
|
||||||
super.render(context, mouseX, mouseY, partialTicks);
|
super.render(context, mouseX, mouseY, partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,31 +6,19 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.lizistired.cavedust.CaveDust.PARTICLE_AMOUNT;
|
import static net.lizistired.cavedust.CaveDust.PARTICLE_AMOUNT;
|
||||||
|
import static net.lizistired.cavedust.utils.ParticleSpawnUtil.shouldParticlesSpawn;
|
||||||
|
|
||||||
@Mixin(DebugHud.class)
|
@Mixin(DebugHud.class)
|
||||||
public abstract class MixinDebugScreenOverlay {
|
public abstract class MixinDebugScreenOverlay {
|
||||||
|
@Inject(method = "getRightText", at = @At("RETURN"))
|
||||||
@Inject(
|
|
||||||
method = "getRightText()Ljava/util/List;",
|
|
||||||
at = @At("RETURN"),
|
|
||||||
cancellable = true,
|
|
||||||
require = 0
|
|
||||||
)
|
|
||||||
private void appendDebugText(CallbackInfoReturnable<List<String>> cir) {
|
private void appendDebugText(CallbackInfoReturnable<List<String>> cir) {
|
||||||
List<String> messages = cir.getReturnValue();
|
List<String> messages = cir.getReturnValue();
|
||||||
if (messages == null) return;
|
|
||||||
|
|
||||||
// Evita modificar una lista inmutable/compartida
|
messages.add("");
|
||||||
List<String> out = new ArrayList<>(messages);
|
messages.add("Particle amount evaluated: " + PARTICLE_AMOUNT);
|
||||||
|
messages.add("");
|
||||||
out.add("");
|
|
||||||
out.add("Particle amount evaluated: " + PARTICLE_AMOUNT);
|
|
||||||
out.add("");
|
|
||||||
|
|
||||||
cir.setReturnValue(out);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package net.lizistired.cavedust.utils;
|
|||||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||||
import net.minecraft.client.option.KeyBinding;
|
import net.minecraft.client.option.KeyBinding;
|
||||||
import net.minecraft.client.util.InputUtil;
|
import net.minecraft.client.util.InputUtil;
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
public class KeybindingHelper {
|
public class KeybindingHelper {
|
||||||
@@ -11,23 +10,19 @@ public class KeybindingHelper {
|
|||||||
public static KeyBinding keyBinding1;
|
public static KeyBinding keyBinding1;
|
||||||
public static KeyBinding keyBinding2;
|
public static KeyBinding keyBinding2;
|
||||||
|
|
||||||
// 1.21.9+ requiere Category (no String)
|
|
||||||
private static final KeyBinding.Category CATEGORY =
|
|
||||||
KeyBinding.Category.create(Identifier.of("cavedust", "spook"));
|
|
||||||
|
|
||||||
public static void registerKeyBindings() {
|
public static void registerKeyBindings(){
|
||||||
keyBinding1 = KeyBindingHelper.registerKeyBinding(new KeyBinding(
|
keyBinding1 = KeyBindingHelper.registerKeyBinding(new KeyBinding(
|
||||||
"key.cavedust.toggle",
|
"key.cavedust.toggle",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,// The translation key of the keybinding's name // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
|
||||||
GLFW.GLFW_KEY_KP_ADD,
|
GLFW.GLFW_KEY_KP_ADD, // The keycode of the key
|
||||||
CATEGORY
|
"category.cavedust.spook" // The translation key of the keybinding's category.
|
||||||
));
|
));
|
||||||
|
|
||||||
keyBinding2 = KeyBindingHelper.registerKeyBinding(new KeyBinding(
|
keyBinding2 = KeyBindingHelper.registerKeyBinding(new KeyBinding(
|
||||||
"key.cavedust.reload",
|
"key.cavedust.reload", // The translation key of the keybinding's name
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
|
||||||
GLFW.GLFW_KEY_KP_ENTER,
|
GLFW.GLFW_KEY_KP_ENTER, // The keycode of the key
|
||||||
CATEGORY
|
"category.cavedust.spook" // The translation key of the keybinding's category.
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -22,21 +23,14 @@ public class ParticleSpawnUtil {
|
|||||||
*/
|
*/
|
||||||
public static boolean shouldParticlesSpawn(MinecraftClient client, CaveDustConfig config) {
|
public static boolean shouldParticlesSpawn(MinecraftClient client, CaveDustConfig config) {
|
||||||
|
|
||||||
if (client.player == null) {
|
//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
|
||||||
timer = 0;
|
|
||||||
shouldParticlesSpawn = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// checks if the config is enabled, if the game isn't paused, if the world is valid,
|
|
||||||
// if the dimension is valid and if the player isn't in a lush caves biome
|
|
||||||
if (!config.getCaveDustEnabled()
|
if (!config.getCaveDustEnabled()
|
||||||
|| client.isPaused()
|
|| client.isPaused()
|
||||||
|| client.world == null
|
|| client.world == null
|
||||||
|| !client.world.getDimension().bedWorks()
|
|| !client.world.getDimension().bedWorks()
|
||||||
|| client.player.isSubmergedInWater()
|
|| Objects.requireNonNull(client.player).isSubmergedInWater()
|
||||||
|| client.world.getBiome(client.player.getBlockPos()).matchesKey(LUSH_CAVES)) {
|
|| client.world.getBiome(Objects.requireNonNull(client.player.getBlockPos())).matchesKey(LUSH_CAVES))
|
||||||
|
{
|
||||||
timer = 0;
|
timer = 0;
|
||||||
shouldParticlesSpawn = false;
|
shouldParticlesSpawn = false;
|
||||||
return false;
|
return false;
|
||||||
@@ -45,18 +39,16 @@ public class ParticleSpawnUtil {
|
|||||||
World world = client.world;
|
World world = client.world;
|
||||||
int seaLevel = world.getSeaLevel();
|
int seaLevel = world.getSeaLevel();
|
||||||
|
|
||||||
// 1.21.10: usar world directamente
|
if (!client.player.clientWorld.isSkyVisible(client.player.getBlockPos())) {
|
||||||
if (!world.isSkyVisible(client.player.getBlockPos())) {
|
if (client.player.getBlockPos().getY() + 2 < seaLevel){
|
||||||
if (client.player.getBlockPos().getY() + 2 < seaLevel) {
|
|
||||||
timer = timer + 1;
|
timer = timer + 1;
|
||||||
if (timer > 10) {
|
if (timer > 10){
|
||||||
timer = 10;
|
timer = 10;
|
||||||
shouldParticlesSpawn = true;
|
shouldParticlesSpawn = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldParticlesSpawn = false;
|
shouldParticlesSpawn = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -70,27 +62,21 @@ public class ParticleSpawnUtil {
|
|||||||
*/
|
*/
|
||||||
public static boolean shouldParticlesSpawn(MinecraftClient client, CaveDustConfig config, BlockPos pos) {
|
public static boolean shouldParticlesSpawn(MinecraftClient client, CaveDustConfig config, BlockPos pos) {
|
||||||
|
|
||||||
// checks if the config is enabled, if the game isn't paused, if the world is valid,
|
//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 the dimension is valid and if the particle position isn't in lush caves
|
|
||||||
if (!config.getCaveDustEnabled()
|
if (!config.getCaveDustEnabled()
|
||||||
|| client.isPaused()
|
|| client.isPaused()
|
||||||
|| 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))
|
||||||
|
|
||||||
|
{
|
||||||
timer = 0;
|
timer = 0;
|
||||||
shouldParticlesSpawn = false;
|
shouldParticlesSpawn = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if(!config.getSuperFlatStatus()) {
|
||||||
if (client.player == null) {
|
|
||||||
timer = 0;
|
|
||||||
shouldParticlesSpawn = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config.getSuperFlatStatus()) {
|
|
||||||
if (((ClientWorldAccessor) client.world.getLevelProperties()).getFlatWorld()) {
|
if (((ClientWorldAccessor) client.world.getLevelProperties()).getFlatWorld()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -99,18 +85,16 @@ public class ParticleSpawnUtil {
|
|||||||
World world = client.world;
|
World world = client.world;
|
||||||
int seaLevel = world.getSeaLevel();
|
int seaLevel = world.getSeaLevel();
|
||||||
|
|
||||||
// 1.21.10: usar world directamente
|
if (!client.player.clientWorld.isSkyVisible(pos)) {
|
||||||
if (!world.isSkyVisible(pos)) {
|
if (pos.getY() + 2 < seaLevel){
|
||||||
if (pos.getY() + 2 < seaLevel) {
|
|
||||||
timer = timer + 1;
|
timer = timer + 1;
|
||||||
if (timer > 10) {
|
if (timer > 10){
|
||||||
timer = 10;
|
timer = 10;
|
||||||
shouldParticlesSpawn = true;
|
shouldParticlesSpawn = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldParticlesSpawn = false;
|
shouldParticlesSpawn = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 250 KiB After Width: | Height: | Size: 116 KiB |
@@ -1,19 +1,15 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "cavedustreforged",
|
"id": "cavedust",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"name": "Cave Dust Reforged",
|
"name": "Cave Dust",
|
||||||
"description": "Makes dust underground that scales with depth!",
|
"description": "Makes dust underground that scales with depth!",
|
||||||
"authors": [
|
"authors": [
|
||||||
"DekinDev"
|
"LizIsTired"
|
||||||
],
|
|
||||||
"contributors": [
|
|
||||||
"LizIsTired (Original mod)"
|
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"issues": "https://git.straice.com/DekinDev/cave_dust_reforged/issues",
|
"issues": "https://github.com/LizIsTired/dust/issues",
|
||||||
"sources": "https://git.straice.com/DekinDev/cave_dust_reforged",
|
"sources": "https://github.com/LizIsTired/dust"
|
||||||
"homepage": "https://modrinth.com/project/cave-dust-reforged"
|
|
||||||
},
|
},
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"icon": "assets/cavedust/icon.png",
|
"icon": "assets/cavedust/icon.png",
|
||||||
@@ -32,12 +28,19 @@
|
|||||||
"cavedust.mixins.json"
|
"cavedust.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.17.2",
|
"fabricloader": ">=0.14.5",
|
||||||
"fabric": "*",
|
"fabric": "*",
|
||||||
"minecraft": "1.21.10",
|
"minecraft": "1.21.1",
|
||||||
"java": ">=17"
|
"java": ">=17"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
"modmenu": ">=3.0.1"
|
"modmenu": ">=3.0.1"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"modmenu": {
|
||||||
|
"links": {
|
||||||
|
"modmenu.discord": "https://discord.gg/4m6kQSX6bx"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user