From 13e71db09d40845765ba1331819a8e49ab2d4712 Mon Sep 17 00:00:00 2001 From: Max Hyper Date: Tue, 26 Nov 2024 20:03:13 -0300 Subject: [PATCH] Added global tree hardness multiplier to config --- .../dynamictrees/block/branch/BasicBranchBlock.java | 2 +- .../dynamictrees/block/branch/BasicRootsBlock.java | 2 +- .../java/com/ferreusveritas/dynamictrees/init/DTConfigs.java | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ferreusveritas/dynamictrees/block/branch/BasicBranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/block/branch/BasicBranchBlock.java index bca3ba82e..e3ac4c584 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/block/branch/BasicBranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/block/branch/BasicBranchBlock.java @@ -209,7 +209,7 @@ public boolean canPlaceLiquid(BlockGetter level, BlockPos pos, BlockState state, public float getHardness(BlockState state, BlockGetter level, BlockPos pos) { final int radius = this.getRadius(level.getBlockState(pos)); final float hardness = this.getFamily().getPrimitiveLog().orElse(Blocks.AIR).defaultBlockState() - .getDestroySpeed(level, pos) * (radius * radius) / 64.0f * 8.0f; + .getDestroySpeed(level, pos) * DTConfigs.TREE_HARDNESS_MULTIPLIER.get().floatValue() * (radius * radius) / 64.0f * 8.0f; return (float) Math.min(hardness, DTConfigs.MAX_TREE_HARDNESS.get()); // So many youtube let's plays start with "OMG, this is taking so long to break this tree!" } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/block/branch/BasicRootsBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/block/branch/BasicRootsBlock.java index c5325bf50..3ac41a798 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/block/branch/BasicRootsBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/block/branch/BasicRootsBlock.java @@ -422,7 +422,7 @@ public float getHardness(BlockState state, BlockGetter level, BlockPos pos) { if (isFullBlock(state)) return getFamily().getPrimitiveCoveredRoots().orElse(Blocks.AIR).defaultDestroyTime(); final int radius = this.getRadius(level.getBlockState(pos)); final float hardness = this.getFamily().getPrimitiveLog().orElse(Blocks.AIR).defaultBlockState() - .getDestroySpeed(level, pos) * (radius * radius) / 64.0f * 8.0f; + .getDestroySpeed(level, pos) * DTConfigs.TREE_HARDNESS_MULTIPLIER.get().floatValue() * (radius * radius) / 64.0f * 8.0f; return (float) Math.min(hardness, DTConfigs.MAX_TREE_HARDNESS.get()); // So many youtube let's plays start with "OMG, this is taking so long to break this tree!" } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java b/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java index 432077200..0313828de 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java @@ -33,6 +33,7 @@ public class DTConfigs { public static final ForgeConfigSpec.DoubleValue TREE_GROWTH_MULTIPLIER; public static final ForgeConfigSpec.DoubleValue TREE_HARVEST_MULTIPLIER; public static final ForgeConfigSpec.DoubleValue MAX_TREE_HARDNESS; + public static final ForgeConfigSpec.DoubleValue TREE_HARDNESS_MULTIPLIER; public static final ForgeConfigSpec.IntValue TREE_GROWTH_FOLDING; public static final ForgeConfigSpec.BooleanValue DROP_STICKS; public static final ForgeConfigSpec.DoubleValue SCALE_BIOME_GROWTH_RATE; @@ -109,6 +110,8 @@ public class DTConfigs { defineInRange("harvestMultiplier", 1f, 0f, 128f); MAX_TREE_HARDNESS = SERVER_BUILDER.comment("Maximum harvesting hardness that can be calculated. Regardless of tree thickness."). defineInRange("maxTreeHardness", 20f, 1f, 200f); + TREE_HARDNESS_MULTIPLIER = SERVER_BUILDER.comment("A multiplier of tree hardness. Higher values make trees slower to chop, lower values makes them faster to chop."). + defineInRange("maxTreeHardness", 1, 0.05f, 20f); TREE_GROWTH_FOLDING = SERVER_BUILDER.comment("Do X growth cycles at once while ignoring (X-1)/X attempts. Higher numbers can improve client side performance but too high can make trees grow wierd."). defineInRange("growthFolding", 2, 1, 8); DROP_STICKS = SERVER_BUILDER.comment("If enabled then sticks will be dropped for partial logs").