Skip to content

Commit

Permalink
Add configs for MaxBreak on tools - per #171
Browse files Browse the repository at this point in the history
  • Loading branch information
Direwolf20-MC committed Sep 26, 2024
1 parent d62af06 commit 9041ea7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.direwolf20.justdirethings.common.items.armors.basearmors.BaseLeggings;
import com.direwolf20.justdirethings.common.items.datacomponents.JustDireDataComponents;
import com.direwolf20.justdirethings.common.items.tools.utils.GooTier;
import com.direwolf20.justdirethings.setup.Config;
import com.direwolf20.justdirethings.util.MiningCollect;
import com.direwolf20.justdirethings.util.MiscHelpers;
import com.direwolf20.justdirethings.util.NBTHelpers;
Expand Down Expand Up @@ -143,14 +144,14 @@ default boolean hurtEnemyAbility(ItemStack pStack, LivingEntity pTarget, LivingE

default Set<BlockPos> getBreakBlockPositions(ItemStack pStack, Level pLevel, BlockPos pPos, LivingEntity pEntityLiving, BlockState pState) {
Set<BlockPos> breakBlockPositions = new HashSet<>();
int maxBreak = 64;
int maxBreak = Config.TOOL_MAX_BREAK_FERRICORE.get();
if (pStack.getItem() instanceof TieredItem tieredItem) {
if (tieredItem.getTier().equals(GooTier.BLAZEGOLD))
maxBreak = 128;
maxBreak = Config.TOOL_MAX_BREAK_BLAZEGOLD.get();
else if (tieredItem.getTier().equals(GooTier.CELESTIGEM))
maxBreak = 192;
maxBreak = Config.TOOL_MAX_BREAK_CELESTIGEM.get();
else if (tieredItem.getTier().equals(GooTier.ECLIPSEALLOY))
maxBreak = 256;
maxBreak = Config.TOOL_MAX_BREAK_ECLIPSEALLOY.get();
}
if (canUseAbility(pStack, Ability.OREMINER) && oreCondition.test(pState) && pStack.isCorrectToolForDrops(pState)) {
breakBlockPositions.addAll(findLikeBlocks(pLevel, pState, pPos, null, maxBreak, 2));
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/direwolf20/justdirethings/setup/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public class Config {

public static final String CATEGORY_ABILITIES = "abilities";
public static Map<Ability, ModConfigSpec.BooleanValue> AVAILABLE_ABILITY_MAP = new HashMap<>();
public static ModConfigSpec.IntValue TOOL_MAX_BREAK_FERRICORE;
public static ModConfigSpec.IntValue TOOL_MAX_BREAK_BLAZEGOLD;
public static ModConfigSpec.IntValue TOOL_MAX_BREAK_CELESTIGEM;
public static ModConfigSpec.IntValue TOOL_MAX_BREAK_ECLIPSEALLOY;

public static final String CATEGORY_GENERATOR_T1 = "generator_t1";
public static ModConfigSpec.IntValue GENERATOR_T1_FE_PER_FUEL_TICK;
Expand Down Expand Up @@ -148,6 +152,14 @@ private static void abilityConfigs() {
AVAILABLE_ABILITY_MAP.put(ability, COMMON_BUILDER.comment(ability.getName())
.define(ability.getName(), true));
}
TOOL_MAX_BREAK_FERRICORE = COMMON_BUILDER.comment("The maximum number of blocks that a Ferricore tool can break as a result of abilities, such as ore miner or tree feller.")
.defineInRange("tool_max_break_ferricore", 64, 1, 2048);
TOOL_MAX_BREAK_BLAZEGOLD = COMMON_BUILDER.comment("The maximum number of blocks that a Blazegold tool can break as a result of abilities, such as ore miner or tree feller.")
.defineInRange("tool_max_break_blazegold", 128, 1, 2048);
TOOL_MAX_BREAK_CELESTIGEM = COMMON_BUILDER.comment("The maximum number of blocks that a Celestigem tool can break as a result of abilities, such as ore miner or tree feller.")
.defineInRange("tool_max_break_celestigem", 192, 1, 2048);
TOOL_MAX_BREAK_ECLIPSEALLOY = COMMON_BUILDER.comment("The maximum number of blocks that a Eclipse Alloy tool can break as a result of abilities, such as ore miner or tree feller.")
.defineInRange("tool_max_break_eclipsealloy", 256, 1, 2048);
COMMON_BUILDER.pop();
}

Expand Down

0 comments on commit 9041ea7

Please sign in to comment.