1515import com .ferreusveritas .dynamictrees .util .BlockBounds ;
1616import com .ferreusveritas .dynamictrees .util .BranchDestructionData ;
1717import com .ferreusveritas .dynamictrees .util .CoordUtils .Surround ;
18+ import com .ferreusveritas .dynamictrees .block .branch .ThickBranchBlock ;
19+ import com .ferreusveritas .dynamictrees .util .CoordUtils .ShellDirection ;
1820import com .google .common .collect .Iterables ;
1921import net .minecraft .client .Minecraft ;
2022import net .minecraft .core .BlockPos ;
@@ -237,12 +239,16 @@ public void buildClient() {
237239 protected void cleanupShellBlocks (BranchDestructionData destroyData ) {
238240 BlockPos cutPos = destroyData .cutPos ;
239241 for (int i = 0 ; i < destroyData .getNumBranches (); i ++) {
240- if (destroyData .getBranchRadius (i ) > 8 ) {
242+ int radius = destroyData .getBranchRadius (i );
243+ if (radius > ThickBranchBlock .RADIUS_TO_INNER_SHELL ) {
241244 BlockPos pos = destroyData .getBranchRelPos (i ).offset (cutPos );
242- for (Surround dir : Surround .values ()) {
243- BlockPos dPos = pos .offset (dir .getOffset ());
244- if (level ().getBlockState (dPos ).getBlock () instanceof TrunkShellBlock ) {
245- level ().removeBlock (dPos , false );
245+ for (ShellDirection dir : ShellDirection .values ()) {
246+ // Only check shells that this radius actually needs
247+ if (dir .getShellLevel () == 1 || dir .getShellLevel () == 2 && radius > ThickBranchBlock .RADIUS_TO_OUTER_SHELL || dir .getShellLevel () == 3 && radius > ThickBranchBlock .RADIUS_TO_OUTERMOST_SHELL ) {
248+ BlockPos dPos = pos .offset (dir .getOffset ());
249+ if (level ().getBlockState (dPos ).getBlock () instanceof TrunkShellBlock ) {
250+ level ().removeBlock (dPos , false );
251+ }
246252 }
247253 }
248254 }
@@ -549,4 +555,4 @@ public static FallingTreeEntity dropTree(Level level, BranchDestructionData dest
549555 return null ;
550556 }
551557
552- }
558+ }
0 commit comments