diff --git a/src/main/java/com/oitsjustjose/charged_explosives/common/blocks/ChargedExplosiveBlock.java b/src/main/java/com/oitsjustjose/charged_explosives/common/blocks/ChargedExplosiveBlock.java index 4b41fd4..3288bb7 100644 --- a/src/main/java/com/oitsjustjose/charged_explosives/common/blocks/ChargedExplosiveBlock.java +++ b/src/main/java/com/oitsjustjose/charged_explosives/common/blocks/ChargedExplosiveBlock.java @@ -195,7 +195,9 @@ public class ChargedExplosiveBlock extends FaceAttachedHorizontalDirectionalBloc if (state.getBlock().defaultDestroyTime() >= 0.0 && !state.isAir()) { level.removeBlock(p, false); /* Ignore the yellow squiggles below - p_49886 is passed to a func where it's Nullable */ - Block.dropResources(state, level, p, null, null, ItemStack.EMPTY); + if (CommonConfig.EXPLOSION_DROPS.get()) { + Block.dropResources(state, level, p, null, null, ItemStack.EMPTY); + } if (level.getRandom().nextBoolean()) { ChargedExplosives.getInstance().PROXY.spawnExplosionParticle(p); } diff --git a/src/main/java/com/oitsjustjose/charged_explosives/common/config/CommonConfig.java b/src/main/java/com/oitsjustjose/charged_explosives/common/config/CommonConfig.java index be0cc83..33a3ec9 100644 --- a/src/main/java/com/oitsjustjose/charged_explosives/common/config/CommonConfig.java +++ b/src/main/java/com/oitsjustjose/charged_explosives/common/config/CommonConfig.java @@ -1,14 +1,13 @@ package com.oitsjustjose.charged_explosives.common.config; -import java.nio.file.Path; - import com.electronwill.nightconfig.core.file.CommentedFileConfig; import com.electronwill.nightconfig.core.io.WritingMode; - import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec.Builder; import net.minecraftforge.fml.common.Mod; +import java.nio.file.Path; + @Mod.EventBusSubscriber public class CommonConfig { public static final ForgeConfigSpec COMMON_CONFIG; @@ -20,6 +19,7 @@ public class CommonConfig { public static ForgeConfigSpec.IntValue MAX_EXPLOSION_DEPTH; public static ForgeConfigSpec.IntValue EXPLOSION_COUNTDOWN_TIME; public static ForgeConfigSpec.IntValue NUM_BEEPS; + public static ForgeConfigSpec.BooleanValue EXPLOSION_DROPS; private static final String CATEGORY_MISC = "common_configuration"; static { @@ -47,8 +47,11 @@ public class CommonConfig { EXPLOSION_COUNTDOWN_TIME = COMMON_BUILDER.comment("The amount of time between activating an explosive and when it detonates, in seconds. Setting to 0 makes it instant") .defineInRange("detonationCountdownTime", 5, 0, Integer.MAX_VALUE); - NUM_BEEPS=COMMON_BUILDER.comment("The number of warning beeps given after setting an explosive off to detonate. Time is distributed evenly across the value configured in 'detonationCountdownTime'") - .defineInRange("detonationBeepCount", 5, 0, Integer.MAX_VALUE); + NUM_BEEPS = COMMON_BUILDER.comment("The number of warning beeps given after setting an explosive off to detonate. Time is distributed evenly across the value configured in 'detonationCountdownTime'") + .defineInRange("detonationBeepCount", 5, 0, Integer.MAX_VALUE); + + EXPLOSION_DROPS = COMMON_BUILDER.comment("Controls if a charge's explosion should provide drops. Setting this to true will drop items, false will not") + .define("explosionsDropItems", true); COMMON_BUILDER.pop(); } diff --git a/src/main/java/com/oitsjustjose/charged_explosives/common/tile/ChargedExplosiveBlockEntity.java b/src/main/java/com/oitsjustjose/charged_explosives/common/tile/ChargedExplosiveBlockEntity.java index 1bda27c..13a10c8 100644 --- a/src/main/java/com/oitsjustjose/charged_explosives/common/tile/ChargedExplosiveBlockEntity.java +++ b/src/main/java/com/oitsjustjose/charged_explosives/common/tile/ChargedExplosiveBlockEntity.java @@ -59,9 +59,9 @@ public class ChargedExplosiveBlockEntity extends BlockEntity { } public float calculateConcussiveDamage() { - return (((float) this.explosionWidth / (CommonConfig.MAX_EXPLOSION_WIDTH.get() / 2F)) + - ((float) this.explosionHeight / (CommonConfig.MAX_EXPLOSION_HEIGHT.get() / 2F)) + - ((float) this.explosionDepth / (CommonConfig.MAX_EXPLOSION_DEPTH.get() / 2F))) * + return (((float) this.explosionWidth / (CommonConfig.MAX_EXPLOSION_WIDTH.get() / 4F)) + + ((float) this.explosionHeight / (CommonConfig.MAX_EXPLOSION_HEIGHT.get() / 4F)) + + ((float) this.explosionDepth / (CommonConfig.MAX_EXPLOSION_DEPTH.get() / 4F))) * CommonConfig.CONCUSSIVE_DAMAGE_SCALE.get().floatValue(); } diff --git a/src/main/resources/data/charged_explosives/recipes/charged_explosive.json b/src/main/resources/data/charged_explosives/recipes/charged_explosive.json new file mode 100644 index 0000000..0cd9a70 --- /dev/null +++ b/src/main/resources/data/charged_explosives/recipes/charged_explosive.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "RRB", + "TTT", + "CCC" + ], + "key": { + "C": {"item": "minecraft:green_concrete"}, + "T": {"item": "minecraft:tnt"}, + "R": {"item": "minecraft:redstone"}, + "B": {"tag": "minecraft:buttons"} + }, + "result": { + "item": "charged_explosives:charged_explosive", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/charged_explosives/recipes/charged_explosive_reset.json b/src/main/resources/data/charged_explosives/recipes/charged_explosive_reset.json new file mode 100644 index 0000000..91c289d --- /dev/null +++ b/src/main/resources/data/charged_explosives/recipes/charged_explosive_reset.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "charged_explosives:charged_explosive" + } + ], + "result": { + "item": "charged_explosives:charged_explosive" + } +} \ No newline at end of file