Skip to content

Commit 43e687a

Browse files
committed
added getBranchForPlacement to family
1 parent d7dbb2c commit 43e687a

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
modName=DynamicTrees
22
modId=dynamictrees
3-
modVersion=0.10.0-Beta33
3+
modVersion=0.10.0-Beta33.1
44
group=com.ferreusveritas.dynamictrees
55

66
mcVersion=1.16.5

src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,19 @@ public Optional<BranchBlock> getBranch() {
445445
return Optionals.ofBlock(branch);
446446
}
447447

448+
/**
449+
* Version of getBranch() used by jocodes to generate the tree.
450+
* By default it acts just like getBranch() but it can be overriden
451+
* by addons to customize the branch selected by the jocode
452+
* @param world The world the tree is generating in
453+
* @param species The species of the tree generated
454+
* @param pos The position of the branch block
455+
* @return branch block picked
456+
*/
457+
public Optional<BranchBlock> getBranchForPlacement(IWorld world, Species species, BlockPos pos) {
458+
return getBranch();
459+
}
460+
448461
public Optional<BranchBlock> getStrippedBranch() {
449462
return Optionals.ofBlock(strippedBranch);
450463
}

src/main/java/com/ferreusveritas/dynamictrees/worldgen/JoCode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ protected boolean setBlockForGeneration(IWorld world, Species species, BlockPos
385385
world.getBlockState(pos).getBlock().is(DTBlockTags.FOLIAGE) ||
386386
world.getBlockState(pos).getBlock().is(BlockTags.FLOWERS)) &&
387387
(!careful || this.isClearOfNearbyBranches(world, pos, dir.getOpposite()))) {
388-
species.getFamily().getBranch().ifPresent(branch ->
388+
species.getFamily().getBranchForPlacement(world, species, pos).ifPresent(branch ->
389389
branch.setRadius(world, pos, species.getFamily().getPrimaryThickness(), null, careful ? 3 : 2)
390390
);
391391
return false;

0 commit comments

Comments
 (0)