diff --git a/src/main/java/kaptainwutax/seedcrackerX/config/Config.java b/src/main/java/kaptainwutax/seedcrackerX/config/Config.java index 78cd09fe..7f9f4f91 100644 --- a/src/main/java/kaptainwutax/seedcrackerX/config/Config.java +++ b/src/main/java/kaptainwutax/seedcrackerX/config/Config.java @@ -7,9 +7,14 @@ import kaptainwutax.seedcrackerX.Features; import kaptainwutax.seedcrackerX.util.FeatureToggle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.*; public class Config { + private static final Logger logger = LoggerFactory.getLogger("config"); + private static final File file = new File(net.fabricmc.loader.api.FabricLoader.getInstance().getConfigDir().toFile(), "seedcracker.json"); private static Config INSTANCE = new Config(); public FeatureToggle buriedTreasure = new FeatureToggle(true); @@ -43,8 +48,7 @@ public static void save() { gson.toJson(INSTANCE, writer); } catch (IOException e) { - System.out.println("seedcracker could't save config"); - e.printStackTrace(); + logger.error("seedcracker could't save config", e); } } @@ -55,10 +59,10 @@ public static void load() { INSTANCE = gson.fromJson(reader, Config.class); } catch (Exception e) { if (file.exists()) { - System.out.println("seedcracker couldn't load config, deleting it..."); + logger.error("seedcracker couldn't load config, deleting it...", e); file.delete(); } else { - System.out.println("seedcracker couldn't find config"); + logger.warn("seedcracker couldn't find config", e); } } } diff --git a/src/main/java/kaptainwutax/seedcrackerX/config/StructureSave.java b/src/main/java/kaptainwutax/seedcrackerX/config/StructureSave.java index 567c29f6..f823bb36 100644 --- a/src/main/java/kaptainwutax/seedcrackerX/config/StructureSave.java +++ b/src/main/java/kaptainwutax/seedcrackerX/config/StructureSave.java @@ -16,7 +16,11 @@ import java.util.List; import java.util.Scanner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class StructureSave { + private static final Logger logger = LoggerFactory.getLogger("structureSave"); public static final File saveDir = new File(FabricLoader.getInstance().getConfigDir().toFile(), "SeedCrackerX saved structures"); private static final List> structureTypes = List.of(Features.IGLOO,Features.BURIED_TREASURE, @@ -39,7 +43,7 @@ public static void saveStructures(ScheduledSet } writer.close(); } catch (IOException e) { - e.printStackTrace(); + logger.error("seedcracker could't save structures", e); } } @@ -64,7 +68,7 @@ public static List> loadStructures() { } } } catch (IOException e) { - e.printStackTrace(); + logger.error("seedcracker could't load previous structures", e); } return result; } diff --git a/src/main/java/kaptainwutax/seedcrackerX/cracker/storage/TimeMachine.java b/src/main/java/kaptainwutax/seedcrackerX/cracker/storage/TimeMachine.java index abc142fc..7cabd633 100644 --- a/src/main/java/kaptainwutax/seedcrackerX/cracker/storage/TimeMachine.java +++ b/src/main/java/kaptainwutax/seedcrackerX/cracker/storage/TimeMachine.java @@ -34,7 +34,11 @@ import java.util.stream.LongStream; import java.util.stream.Stream; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class TimeMachine { + private static final Logger logger = LoggerFactory.getLogger("timeMachine"); public static ExecutorService SERVICE = Executors.newFixedThreadPool(5); @@ -291,7 +295,7 @@ protected boolean pokeBiomes() { Log.warn("tmachine.printSeedsInConsole"); } } else { - System.out.println("Found world seed " + worldSeed); + logger.info("Found world seed " + worldSeed); } } @@ -389,7 +393,7 @@ protected boolean pokeBiomes() { Log.warn("tmachine.printSeedsInConsole"); } } else { - System.out.println("Found world seed " + worldSeed); + logger.info("Found world seed " + worldSeed); } } diff --git a/src/main/java/kaptainwutax/seedcrackerX/finder/decorator/WarpedFungusFinder.java b/src/main/java/kaptainwutax/seedcrackerX/finder/decorator/WarpedFungusFinder.java index 8247e186..db605c53 100644 --- a/src/main/java/kaptainwutax/seedcrackerX/finder/decorator/WarpedFungusFinder.java +++ b/src/main/java/kaptainwutax/seedcrackerX/finder/decorator/WarpedFungusFinder.java @@ -25,7 +25,11 @@ import java.util.List; import java.util.function.Predicate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class WarpedFungusFinder extends BlockFinder { + private static final Logger logger = LoggerFactory.getLogger("warpedFungusFinder"); private static final Predicate prdc = block -> (block == Blocks.SHROOMLIGHT || block == Blocks.WARPED_WART_BLOCK); @@ -204,7 +208,7 @@ public List findInChunk() { blocktype = 3; } else { blocktype = 0; - System.out.println("error found illegal Block: " + block.getName() + " at " + pos.add(x, y, z).toShortString()); + logger.error("error found illegal Block: " + block.getName() + " at " + pos.add(x, y, z).toShortString()); } layers[counter][x + layerSize][z + layerSize] = blocktype; }