client config setting for arrow particle count,

This commit is contained in:
Jenny 2025-01-25 21:52:30 +01:00
parent 3587ccbc8a
commit 27e2c56cb9
Signed by: Jenny
GPG Key ID: 4A98012FB1C39311
5 changed files with 24 additions and 18 deletions
gradle.properties
src/main/java/com/jenny/enhancedexplosives

@ -38,7 +38,7 @@ mod_name=Enhanced Explosives
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=0.8.2
mod_version=0.8.3
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

@ -15,13 +15,19 @@ public class ConfigClient {
BUILDER.comment("weather to spawn client-side particles for arrows")
.define("arrowParticles", true);
private static final ForgeConfigSpec.ConfigValue<Integer> C_ARROW_PARTICLE_COUNT =
BUILDER.comment("amount of particles to spawn per arrow per tick")
.define("arrowParticleCount", 3);
public static final ForgeConfigSpec SPEC = BUILDER.build();
public static boolean ARROW_PARTICLES;
public static boolean arrowParticles;
public static int arrowParticleCount;
@SubscribeEvent
static void onLoad(final ModConfigEvent event)
{
ARROW_PARTICLES = C_ARROW_PARTICLES.get();
arrowParticles = C_ARROW_PARTICLES.get();
arrowParticleCount = C_ARROW_PARTICLE_COUNT.get();
}
}

@ -2,6 +2,8 @@ package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.config.ConfigClient;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
@ -21,9 +23,6 @@ public class concussiveArrow extends baseArrow{
@Override
public void tick() {
super.tick();
if (level().isClientSide()) {
level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
}
if (this.inGround) {
this.level().explode(this, getX(), getY(), getZ(), 8.0f, Level.ExplosionInteraction.NONE);
//this.level().explode(this, null, new NilExplosionCalculator(), this.getX(), this.getY(), this.getZ(), 8, false, Level.ExplosionInteraction.NONE);
@ -45,7 +44,7 @@ public class concussiveArrow extends baseArrow{
@Override
public void spawnParticles() {
for (int i = 0; i < 2; i++) {
for (int i = 1; i <= ConfigClient.arrowParticleCount; i++) {
double x = getX() + (double) level().getRandom().nextInt(-10, 11) / 10;
double y = getY() + (double) level().getRandom().nextInt(-10, 11) / 10;
double z = getZ() + (double) level().getRandom().nextInt(-10, 11) / 10;

@ -1,5 +1,6 @@
package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.items.items;
import com.jenny.enhancedexplosives.entities.entities;
@ -31,16 +32,6 @@ public class tntArrow extends baseArrow {
}
}
@Override
public void spawnParticles() {
for (int i = 0; i < 2; i++) {
double x = getX() + (double) level().getRandom().nextInt(-10, 11) / 10;
double y = getY() + (double) level().getRandom().nextInt(-10, 11) / 10;
double z = getZ() + (double) level().getRandom().nextInt(-10, 11) / 10;
level().addParticle(ParticleTypes.WAX_ON, x, y, z, this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
}
}
@Override
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
@ -51,4 +42,14 @@ public class tntArrow extends baseArrow {
protected ItemStack getPickupItem() {
return new ItemStack(items.TNT_ARROW.get());
}
@Override
public void spawnParticles() {
for (int i = 1; i <= ConfigClient.arrowParticleCount; i++) {
double x = getX() + (double) level().getRandom().nextInt(-10, 11) / 10;
double y = getY() + (double) level().getRandom().nextInt(-10, 11) / 10;
double z = getZ() + (double) level().getRandom().nextInt(-10, 11) / 10;
level().addParticle(ParticleTypes.WAX_ON, x, y, z, this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
}
}
}

@ -17,7 +17,7 @@ import net.minecraft.world.level.block.Blocks;
import org.jetbrains.annotations.NotNull;
public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
private final boolean renderParticles = ConfigClient.ARROW_PARTICLES;
private final boolean renderParticles = ConfigClient.arrowParticles;
private final BlockRenderDispatcher blockRenderer;
public TNTArrowRenderer(EntityRendererProvider.Context pContext) {