Skip to content

Commit

Permalink
Added debug output for growth requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryLoenwind committed Jan 6, 2016
1 parent e272c91 commit c7e65f2
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"), //
;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public enum Section {
VOIDTANK("void tank"),
WATERWORKS("waterworks"),
LIQUIDS("liquids"),
DEV("development");
DEV("development", false);

@Nonnull
public final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit c7e65f2

Please sign in to comment.