From 6932e468cfbcf0dbf81fd8672e04944133c85968 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Tue, 20 Jul 2021 21:46:56 +0200 Subject: [PATCH] comments, debug. --- .../com/volmit/iris/core/TreeManager.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/volmit/iris/core/TreeManager.java b/src/main/java/com/volmit/iris/core/TreeManager.java index 24e9dfa65..11dcb6fd9 100644 --- a/src/main/java/com/volmit/iris/core/TreeManager.java +++ b/src/main/java/com/volmit/iris/core/TreeManager.java @@ -25,11 +25,10 @@ public class TreeManager implements Listener { /**This function does the following *
1. Is the sapling growing in an Iris world? No -> exit
- *
2. Is the sapling overwriting setting on in that dimension? No -> exit
- *
3. Check biome for overrides for that sapling type -> Found -> use
- *
4. Check region ...
- *
5. Check dimension ...
- *
6. Exit if none are found
+ *
2. Is the Iris world accessible? No -> exit
+ *
3. Is the sapling overwriting setting on in that dimension? No -> exit
+ *
4. Check biome, region and dimension for overrides for that sapling type -> Found -> use
+ *
5. Exit if none are found, cancel event if one or more are.
* @param event Checks the given event for sapling overrides */ @EventHandler @@ -66,7 +65,13 @@ public class TreeManager implements Listener { KMap>> sizes = IrisTreeSize.getValidSizes(event.getLocation()); KList keys = sizes.k(); - // Find best object placement based on size + // Check if any were returned + if (keys.isEmpty()) { + Iris.debug(this.getClass().getName() + " found no matching sapling sizes for the grow event, which should be impossible (considering ONE is an option)"); + return; + } + + // Find best object placement based on sizes IrisObjectPlacement placement = null; while (placement == null && keys.isNotEmpty()){ IrisTreeSize bestSize = IrisTreeSize.bestSizeInSizes(keys); @@ -74,8 +79,9 @@ public class TreeManager implements Listener { placement = getObjectPlacement(worldAccess, event.getLocation(), type, bestSize); } - // If none was found, just exit + // If none were found, just exit if (placement == null) { + Iris.debug(this.getClass().getName() + " had options but did not manage to find objectplacements for them"); return; }