Skip to content

Commit

Permalink
Added global tree hardness multiplier to config
Browse files Browse the repository at this point in the history
  • Loading branch information
supermassimo committed Nov 26, 2024
1 parent 2af0051 commit 13e71db
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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").
Expand Down

0 comments on commit 13e71db

Please sign in to comment.