From c7e65f25d1ca66c8be6ade4df166f446c8f6289c Mon Sep 17 00:00:00 2001 From: HenryLoenwind Date: Wed, 6 Jan 2016 02:29:09 +0100 Subject: [PATCH] Added debug output for growth requirements --- gradle.properties | 2 +- .../loenwind/enderioaddons/config/Config.java | 1 + .../enderioaddons/config/Section.java | 2 +- .../plant/EioaGrowthRequirement.java | 38 +++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index d5dd91a..c209fa3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ minecraft_version=1.7.10 forge_version=10.13.4.1492-1.7.10 forgeDep_version=10.13.4 -mod_version=0.10.4 +mod_version=0.10.5 #Comment out this line to get rid of the appendix mod_appendix=beta diff --git a/src/main/java/info/loenwind/enderioaddons/config/Config.java b/src/main/java/info/loenwind/enderioaddons/config/Config.java index 89f09a7..1497e98 100644 --- a/src/main/java/info/loenwind/enderioaddons/config/Config.java +++ b/src/main/java/info/loenwind/enderioaddons/config/Config.java @@ -192,6 +192,7 @@ public enum Config { "A comma-seperated list of durations in seconds. For these, self-reseting levers will be created. Set to 0 to disable the lever", true, true), // profilingEnabled(Section.DEV, false, "When enabled, profiling information will be written into the logfile"), // + growthRequirementDebuggingEnabled(Section.DEV, false, "When enabled, growth requirement data will be written into the logfile"), // ; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/info/loenwind/enderioaddons/config/Section.java b/src/main/java/info/loenwind/enderioaddons/config/Section.java index a251993..1d5e7ce 100644 --- a/src/main/java/info/loenwind/enderioaddons/config/Section.java +++ b/src/main/java/info/loenwind/enderioaddons/config/Section.java @@ -19,7 +19,7 @@ public enum Section { VOIDTANK("void tank"), WATERWORKS("waterworks"), LIQUIDS("liquids"), - DEV("development"); + DEV("development", false); @Nonnull public final String name; diff --git a/src/main/java/info/loenwind/enderioaddons/plant/EioaGrowthRequirement.java b/src/main/java/info/loenwind/enderioaddons/plant/EioaGrowthRequirement.java index 6836cf8..ee167f8 100644 --- a/src/main/java/info/loenwind/enderioaddons/plant/EioaGrowthRequirement.java +++ b/src/main/java/info/loenwind/enderioaddons/plant/EioaGrowthRequirement.java @@ -3,6 +3,7 @@ import static info.loenwind.enderioaddons.config.Config.seedsRFperGrowthTick; import info.loenwind.enderioaddons.common.Log; import info.loenwind.enderioaddons.common.WorldHelper; +import info.loenwind.enderioaddons.config.Config; import info.loenwind.enderioaddons.recipe.Recipes; import java.lang.reflect.InvocationTargetException; @@ -56,6 +57,43 @@ public EioaGrowthRequirement() { @Override public boolean canGrow(World world, int x, int y, int z) { + if (Config.growthRequirementDebuggingEnabled.getBoolean()) { + String txt = "Plant at " + x + "/" + y + "/" + z + ": "; + if (isValidSoil(world, x, y - 1, z)) { + txt += "Soil (" + capBank + ") is valid. "; + } else { + txt += "Soil (" + capBank + ") is NOT valid, it is " + WorldHelper.getBlock(world, x, y, z) + ":" + WorldHelper.getMeta(world, x, y, z) + ". "; + } + if (isBaseBlockPresent(world, x, y, z)) { + txt += "Base block (" + bedrock + ") is valid directly below soil. "; + } else if (isBaseBlockPresent(world, x, y - 1, z)) { + txt += "Base block (" + bedrock + ") is valid one below soil. "; + } else { + txt += "Base block (" + bedrock + ") is MISSING. Block directly below soil is " + WorldHelper.getBlock(world, x, y - 1, z) + ":" + + WorldHelper.getMeta(world, x, y - 1, z) + ", block below that is " + WorldHelper.getBlock(world, x, y - 2, z) + ":" + + WorldHelper.getMeta(world, x, y - 2, z) + ". "; + } + if (areBarsPresent(world, x, y, z)) { + txt += "Bars (" + darkBar + ") are valid. "; + } else { + txt += "Bars (" + darkBar + ") are NOT valid. "; + } + if (isBrightnessOk(world, x, y, z)) { + txt += "Light levels (sky light " + brightness[2] + "..." + brightness[3] + " and block light " + brightness[0] + "..." + brightness[1] + ") are ok. "; + } else { + txt += "Light levels (sky light " + brightness[2] + "..." + brightness[3] + " and block light " + brightness[0] + "..." + brightness[1] + + ") are NOT ok, sky light is " + world.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) + ", block light is " + + world.getSavedLightValue(EnumSkyBlock.Block, x, y, z) + ". "; + } + if (world.isRemote) { + txt += "Power level in the capacitor bank can only be checked server-side. "; + } else if (hasPower(world, x, y, z)) { + txt += "Power level in the capacitor bank is ok. "; + } else { + txt += "Power level in the capacitor bank is too low. "; + } + Log.info(txt); + } return isValidSoil(world, x, y - 1, z) && (isBaseBlockPresent(world, x, y, z) || isBaseBlockPresent(world, x, y - 1, z)) && areBarsPresent(world, x, y, z) && isBrightnessOk(world, x, y, z) && hasPower(world, x, y, z); }