diff --git a/gradle.properties b/gradle.properties index 5ed9d7f..4baf1c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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.13.0 +mod_version=0.13.1 # 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 diff --git a/src/main/java/com/jenny/enhancedexplosives/blocks/enderTNTBlock.java b/src/main/java/com/jenny/enhancedexplosives/blocks/enderTNTBlock.java index 5a8f9ef..a186290 100644 --- a/src/main/java/com/jenny/enhancedexplosives/blocks/enderTNTBlock.java +++ b/src/main/java/com/jenny/enhancedexplosives/blocks/enderTNTBlock.java @@ -1,8 +1,7 @@ package com.jenny.enhancedexplosives.blocks; -import com.jenny.enhancedexplosives.entities.tnt.enderPrimedTNT; import com.jenny.enhancedexplosives.config.ConfigClient; - +import com.jenny.enhancedexplosives.entities.tnt.enderPrimedTNT; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; @@ -15,7 +14,6 @@ import net.minecraft.world.level.block.TntBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.levelgen.Heightmap; - import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; @@ -95,7 +93,7 @@ public class enderTNTBlock extends TntBlock { } public static void spawnParticles(Level level, BlockPos blockPos) { - if (ConfigClient.tntParticles) { + if (ConfigClient.tntParticles.get()) { for (int i = 1; i <= ConfigClient.calcPCount(30); i++) { float x = blockPos.getX() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10 + 0.5F; float y = blockPos.getY() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10; diff --git a/src/main/java/com/jenny/enhancedexplosives/blocks/repulsiveTNTBlock.java b/src/main/java/com/jenny/enhancedexplosives/blocks/repulsiveTNTBlock.java index dedc101..e5cbb3b 100644 --- a/src/main/java/com/jenny/enhancedexplosives/blocks/repulsiveTNTBlock.java +++ b/src/main/java/com/jenny/enhancedexplosives/blocks/repulsiveTNTBlock.java @@ -1,6 +1,5 @@ package com.jenny.enhancedexplosives.blocks; -import com.jenny.enhancedexplosives.entities.tnt.blackHolePrimedTNT; import com.jenny.enhancedexplosives.entities.tnt.repulsivePrimedTNT; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/jenny/enhancedexplosives/config/ConfigClient.java b/src/main/java/com/jenny/enhancedexplosives/config/ConfigClient.java index b11a51b..951539d 100644 --- a/src/main/java/com/jenny/enhancedexplosives/config/ConfigClient.java +++ b/src/main/java/com/jenny/enhancedexplosives/config/ConfigClient.java @@ -1,42 +1,37 @@ package com.jenny.enhancedexplosives.config; import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.config.ModConfigEvent; import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID; @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ConfigClient { private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); + public static final ForgeConfigSpec SPEC; - private static final ForgeConfigSpec.ConfigValue C_ARROW_PARTICLES = - BUILDER.comment("whether to spawn client-side particles for arrows") - .define("arrowParticles", true); + public static final ForgeConfigSpec.ConfigValue arrowParticles; + public static final ForgeConfigSpec.ConfigValue tntParticles; + private static final ForgeConfigSpec.ConfigValue particlePercent; - private static final ForgeConfigSpec.ConfigValue C_TNT_PARTICLES = - BUILDER.comment("weather to spawn client-side particles for tnt") - .define("tntParticles", true); + static { - private static final ForgeConfigSpec.ConfigValue C_PARTICLE_PERCENT = - BUILDER.comment("amount of particles to spawn (0.0 = None, 1.0 = normal, values higher are valid too)") - .define("arrowParticleCount", 1.0D); - public static final ForgeConfigSpec SPEC = BUILDER.build(); + arrowParticles = + BUILDER.comment("particles from arrows arrows") + .define("arrow_particles", true); + tntParticles = + BUILDER.comment("particles from tnt") + .define("tnt_particles", true); + particlePercent = + BUILDER.comment("amount of spawned particles (0.0 = None, 1.0 = normal, values higher are valid too)") + .define("particle_amount", 1.0D); - public static boolean arrowParticles, tntParticles; - public static float particlePercent; + SPEC = BUILDER.build(); - @SubscribeEvent - static void onLoad(final ModConfigEvent event) - { - arrowParticles = C_ARROW_PARTICLES.get(); - tntParticles = C_TNT_PARTICLES.get(); - particlePercent = C_PARTICLE_PERCENT.get().floatValue(); } public static int calcPCount(int pCount) { - return Math.round(pCount * particlePercent); + return (int) Math.round(pCount * particlePercent.get()); } } diff --git a/src/main/java/com/jenny/enhancedexplosives/entities/arrows/baseArrow.java b/src/main/java/com/jenny/enhancedexplosives/entities/arrows/baseArrow.java index 720077c..22ac95c 100644 --- a/src/main/java/com/jenny/enhancedexplosives/entities/arrows/baseArrow.java +++ b/src/main/java/com/jenny/enhancedexplosives/entities/arrows/baseArrow.java @@ -1,5 +1,6 @@ package com.jenny.enhancedexplosives.entities.arrows; +import com.jenny.enhancedexplosives.config.ConfigClient; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.projectile.AbstractArrow; @@ -26,7 +27,7 @@ public class baseArrow extends AbstractArrow { public void tick() { super.tick(); if (this.level().isClientSide) { - if (!this.inGround) { + if (!this.inGround && ConfigClient.arrowParticles.get()) { spawnParticles(0); } this.tick++; diff --git a/src/main/java/com/jenny/enhancedexplosives/entities/client/BaseTNTRenderer.java b/src/main/java/com/jenny/enhancedexplosives/entities/client/BaseTNTRenderer.java index 84a5893..938d990 100644 --- a/src/main/java/com/jenny/enhancedexplosives/entities/client/BaseTNTRenderer.java +++ b/src/main/java/com/jenny/enhancedexplosives/entities/client/BaseTNTRenderer.java @@ -1,6 +1,5 @@ package com.jenny.enhancedexplosives.entities.client; -import com.jenny.enhancedexplosives.config.ConfigClient; import com.jenny.enhancedexplosives.entities.tnt.basePrimedTNT; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; diff --git a/src/main/java/com/jenny/enhancedexplosives/entities/client/TNTArrowRenderer.java b/src/main/java/com/jenny/enhancedexplosives/entities/client/TNTArrowRenderer.java index 24a42ac..2b248fa 100644 --- a/src/main/java/com/jenny/enhancedexplosives/entities/client/TNTArrowRenderer.java +++ b/src/main/java/com/jenny/enhancedexplosives/entities/client/TNTArrowRenderer.java @@ -1,8 +1,6 @@ package com.jenny.enhancedexplosives.entities.client; import com.jenny.enhancedexplosives.entities.arrows.baseArrow; -import com.jenny.enhancedexplosives.config.*; - import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; import net.minecraft.client.renderer.MultiBufferSource; @@ -13,7 +11,6 @@ import net.minecraft.client.renderer.entity.TntMinecartRenderer; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Blocks; - import org.jetbrains.annotations.NotNull; public class TNTArrowRenderer extends EntityRenderer { diff --git a/src/main/java/com/jenny/enhancedexplosives/entities/throwable/dynamite.java b/src/main/java/com/jenny/enhancedexplosives/entities/throwable/dynamite.java index 3852461..ae6c44f 100644 --- a/src/main/java/com/jenny/enhancedexplosives/entities/throwable/dynamite.java +++ b/src/main/java/com/jenny/enhancedexplosives/entities/throwable/dynamite.java @@ -2,7 +2,6 @@ package com.jenny.enhancedexplosives.entities.throwable; import com.jenny.enhancedexplosives.entities.entities; import com.jenny.enhancedexplosives.entities.tnt.basePrimedTNT; -import net.minecraft.core.particles.ParticleTypes; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; diff --git a/src/main/java/com/jenny/enhancedexplosives/entities/tnt/basePrimedTNT.java b/src/main/java/com/jenny/enhancedexplosives/entities/tnt/basePrimedTNT.java index 112fb1c..8821faa 100644 --- a/src/main/java/com/jenny/enhancedexplosives/entities/tnt/basePrimedTNT.java +++ b/src/main/java/com/jenny/enhancedexplosives/entities/tnt/basePrimedTNT.java @@ -67,7 +67,7 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity { public void tick() { if (level().isClientSide) { - if (ConfigClient.tntParticles) { + if (ConfigClient.tntParticles.get()) { spawnParticles(); } }