Skip to content

Commit

Permalink
Debug messages will now only print in a development environment. Also…
Browse files Browse the repository at this point in the history
… removed the message about pre-registered blocks.
  • Loading branch information
Haven-King committed Apr 13, 2020
1 parent 9ac1874 commit 1a202c5
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/java/dev/hephaestus/fiblib/FibLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import dev.hephaestus.fiblib.blocks.BlockFib;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongSet;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundTag;
Expand All @@ -29,13 +30,21 @@ public class FibLib {
private static final String SAVE_KEY = "fiblib";

static void log(String msg) {
LOGGER.info(String.format("[%s] %s", MOD_NAME, msg));
LOGGER.info("%s", msg);
}

static void log(String format, Object... args) {
LOGGER.info(String.format("[%s] %s", MOD_NAME, String.format(format, args)));
}

static void debug(String msg) {
debug("%s", msg);
}

static void debug(String format, Object... args) {
if (FabricLoader.getInstance().isDevelopmentEnvironment()) LOGGER.info(String.format("[%s] %s", MOD_NAME, String.format(format, args)));
}

public static class Blocks extends PersistentState {
private static final String SAVE_KEY = FibLib.SAVE_KEY + "_blocks";

Expand Down Expand Up @@ -70,9 +79,9 @@ private static FibLib.Blocks getInstance(ServerWorld world) {
}
}

if (i > 0) {
FibLib.log("Registered %d pre-loaded Block%s", i, i == 1 ? "" : "s");
}
// if (i > 0) {
// FibLib.debug("Registered %d pre-loaded Block%s", i, i == 1 ? "" : "s");
// }

return instance;
}
Expand All @@ -97,7 +106,7 @@ public static void registerPreloadedFibs(ServerWorld world) {
}
}

if (i > 0) FibLib.log("Registered %d pre-loaded BlockFib%s", i, i == 1 ? "" : "s");
if (i > 0) FibLib.debug("Registered %d pre-loaded BlockFib%s", i, i == 1 ? "" : "s");
}

@Internal
Expand Down

0 comments on commit 1a202c5

Please sign in to comment.