Skip to content

Commit edbbed7

Browse files
committed
fixed canopies getting cut off during worldgen
1 parent 82e3d4f commit edbbed7

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ dependencies {
9292
compileOnly(fg.deobf("mezz.jei:jei-$mcVersion-common-api:${property("jeiVersion")}"))
9393
runtimeOnly(fg.deobf("mezz.jei:jei-$mcVersion-forge:${property("jeiVersion")}"))
9494

95-
implementation(fg.deobf("curse.maven:glitchcore-955399:${property("gcVersion")}"))
96-
implementation(fg.deobf("curse.maven:SereneSeasons-291874:${property("ssVersion")}"))
95+
compileOnly(fg.deobf("curse.maven:glitchcore-955399:${property("gcVersion")}"))
96+
compileOnly(fg.deobf("curse.maven:SereneSeasons-291874:${property("ssVersion")}"))
9797

9898
runtimeOnly(fg.deobf("vazkii.patchouli:Patchouli:${property("patchouliVersion")}"))
9999

src/main/java/com/ferreusveritas/dynamictrees/api/TreeHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ public static void ageVolume(LevelAccessor level, SimpleVoxmap leafMap, int iter
7272
int prevHydro = leafMap.getVoxel(iPos);//The leafMap should contain accurate hydro data
7373
int newHydro = ((Ageable) block).age(level, iPos, blockState, level.getRandom(), safeBounds);//Get new values from neighbors
7474
if (newHydro == -1) {
75-
//Leaf block died. Take it out of the leafMap and iterMap
75+
//Leaf block died. Take it out of the leafMap and iterMap
7676
leafMap.setVoxel(iPos, (byte) 0);
7777
iterMap.setVoxel(iPos, (byte) 0);
7878
} else {
7979
//Leaf did not die so the block is still leaves
8080
if (prevHydro == newHydro) { //But it didn't change
8181
iterMap.setVoxel(iPos, (byte) 0); //Stop iterating over it if it's not changing
82-
} else {//Oh wait.. it did change
82+
} else {//Oh, wait... it did change
8383
//Update both maps with this new hydro value
8484
leafMap.setVoxel(iPos, (byte) newHydro);
8585
iterMap.setVoxel(iPos, (byte) newHydro);

src/main/java/com/ferreusveritas/dynamictrees/block/leaves/DynamicLeavesBlock.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,6 @@ public int updateHydro(LevelAccessor accessor, BlockPos pos, BlockState state, b
270270
// does not affect appearance or behavior, unless appearanceChangesWithHydro. For the same reason we use the 0x04 flag to prevent the block from being re-rendered.
271271
// however if the new hydro is 0, it means the leaves were removed and we do need to update, so the flag is 3.
272272
int flag = newHydro == 0 ? 3 : (appearanceChangesWithHydro(oldHydro, newHydro) ? 2 : 4);
273-
// if (newHydro == 0 && !worldGen
274-
// && (accessor instanceof Level level)
275-
// //if the old hydro is the default then its most likely a block that was just placed and failed
276-
// && oldHydro != getProperties().getCellKit().getDefaultHydration()) {
277-
// dropResources(state, level, pos);
278-
// }
279273
accessor.setBlock(pos, placeState, flag);
280274
}
281275
return newHydro;

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,11 @@ public void generate(GenerationContext context) {
196196
}
197197

198198
// If a branch exists then the growth was successful.
199-
200-
final SimpleVoxmap leafMap = new SimpleVoxmap(radius * 2 + 1, species.getWorldGenLeafMapHeight(), radius * 2 + 1).setMapAndCenter(treePos, new BlockPos(radius, 0, radius));
199+
SimpleVoxmap leafCluster = species.getLeavesProperties().getCellKit().getLeafCluster();
200+
int leafMapXLen = radius * 2 + leafCluster.getLenX();
201+
int leafMapZLen = radius * 2 + leafCluster.getLenZ();
202+
final SimpleVoxmap leafMap = new SimpleVoxmap(leafMapXLen, species.getWorldGenLeafMapHeight(), leafMapZLen)
203+
.setMapAndCenter(treePos, new BlockPos(leafMapXLen/2, 0, leafMapZLen/2));
201204
final NodeInspector inflator = species.getNodeInflator(leafMap); // This is responsible for thickening the branches.
202205
final FindEndsNode endFinder = new FindEndsNode(); // This is responsible for gathering a list of branch end points.
203206
final MapSignal signal = new MapSignal(inflator, endFinder); // The inflator signal will "paint" a temporary voxmap of all of the leaves and branches.

0 commit comments

Comments
 (0)