Skip to content

Commit c7e65f2

Browse files
committed
Added debug output for growth requirements
1 parent e272c91 commit c7e65f2

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ minecraft_version=1.7.10
22
forge_version=10.13.4.1492-1.7.10
33
forgeDep_version=10.13.4
44

5-
mod_version=0.10.4
5+
mod_version=0.10.5
66

77
#Comment out this line to get rid of the appendix
88
mod_appendix=beta

src/main/java/info/loenwind/enderioaddons/config/Config.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ public enum Config {
192192
"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), //
193193

194194
profilingEnabled(Section.DEV, false, "When enabled, profiling information will be written into the logfile"), //
195+
growthRequirementDebuggingEnabled(Section.DEV, false, "When enabled, growth requirement data will be written into the logfile"), //
195196
;
196197

197198
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

src/main/java/info/loenwind/enderioaddons/config/Section.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public enum Section {
1919
VOIDTANK("void tank"),
2020
WATERWORKS("waterworks"),
2121
LIQUIDS("liquids"),
22-
DEV("development");
22+
DEV("development", false);
2323

2424
@Nonnull
2525
public final String name;

src/main/java/info/loenwind/enderioaddons/plant/EioaGrowthRequirement.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static info.loenwind.enderioaddons.config.Config.seedsRFperGrowthTick;
44
import info.loenwind.enderioaddons.common.Log;
55
import info.loenwind.enderioaddons.common.WorldHelper;
6+
import info.loenwind.enderioaddons.config.Config;
67
import info.loenwind.enderioaddons.recipe.Recipes;
78

89
import java.lang.reflect.InvocationTargetException;
@@ -56,6 +57,43 @@ public EioaGrowthRequirement() {
5657

5758
@Override
5859
public boolean canGrow(World world, int x, int y, int z) {
60+
if (Config.growthRequirementDebuggingEnabled.getBoolean()) {
61+
String txt = "Plant at " + x + "/" + y + "/" + z + ": ";
62+
if (isValidSoil(world, x, y - 1, z)) {
63+
txt += "Soil (" + capBank + ") is valid. ";
64+
} else {
65+
txt += "Soil (" + capBank + ") is NOT valid, it is " + WorldHelper.getBlock(world, x, y, z) + ":" + WorldHelper.getMeta(world, x, y, z) + ". ";
66+
}
67+
if (isBaseBlockPresent(world, x, y, z)) {
68+
txt += "Base block (" + bedrock + ") is valid directly below soil. ";
69+
} else if (isBaseBlockPresent(world, x, y - 1, z)) {
70+
txt += "Base block (" + bedrock + ") is valid one below soil. ";
71+
} else {
72+
txt += "Base block (" + bedrock + ") is MISSING. Block directly below soil is " + WorldHelper.getBlock(world, x, y - 1, z) + ":"
73+
+ WorldHelper.getMeta(world, x, y - 1, z) + ", block below that is " + WorldHelper.getBlock(world, x, y - 2, z) + ":"
74+
+ WorldHelper.getMeta(world, x, y - 2, z) + ". ";
75+
}
76+
if (areBarsPresent(world, x, y, z)) {
77+
txt += "Bars (" + darkBar + ") are valid. ";
78+
} else {
79+
txt += "Bars (" + darkBar + ") are NOT valid. ";
80+
}
81+
if (isBrightnessOk(world, x, y, z)) {
82+
txt += "Light levels (sky light " + brightness[2] + "..." + brightness[3] + " and block light " + brightness[0] + "..." + brightness[1] + ") are ok. ";
83+
} else {
84+
txt += "Light levels (sky light " + brightness[2] + "..." + brightness[3] + " and block light " + brightness[0] + "..." + brightness[1]
85+
+ ") are NOT ok, sky light is " + world.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) + ", block light is "
86+
+ world.getSavedLightValue(EnumSkyBlock.Block, x, y, z) + ". ";
87+
}
88+
if (world.isRemote) {
89+
txt += "Power level in the capacitor bank can only be checked server-side. ";
90+
} else if (hasPower(world, x, y, z)) {
91+
txt += "Power level in the capacitor bank is ok. ";
92+
} else {
93+
txt += "Power level in the capacitor bank is too low. ";
94+
}
95+
Log.info(txt);
96+
}
5997
return isValidSoil(world, x, y - 1, z) && (isBaseBlockPresent(world, x, y, z) || isBaseBlockPresent(world, x, y - 1, z)) && areBarsPresent(world, x, y, z)
6098
&& isBrightnessOk(world, x, y, z) && hasPower(world, x, y, z);
6199
}

0 commit comments

Comments
 (0)