recipes, block drop conf

This commit is contained in:
oitsjustjose 2022-10-18 15:17:21 -05:00
commit d63b932d46
5 changed files with 43 additions and 9 deletions

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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
}
}

View file

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "charged_explosives:charged_explosive"
}
],
"result": {
"item": "charged_explosives:charged_explosive"
}
}