Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
Add log and fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wohaopa committed May 17, 2024
1 parent e5ad2bf commit 59179f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Handlers {
public static void init() {
if (!Strategy.prevInit()) return;

GTNHModifyMod.LOG.info("Start processing the recipe");
if (methods.isEmpty()) {
String pkg = Handlers.class.getName()
.replace("Handlers", "");
Expand All @@ -29,14 +30,18 @@ public static void init() {
if (iHandler != null) {
Method method = clazz.getDeclaredMethod(iHandler.value());
methods.add(method);
GTNHModifyMod.LOG.info("Discovery handler: " + className);
}
} catch (ClassNotFoundException | NoSuchMethodException e) {
GTNHModifyMod.LOG.debug("An error occurred while initializing handler. Reason: " + e.getMessage());
}
}
} else {

for (Method method : methods) {
try {
GTNHModifyMod.LOG.info(
"Invoke handler: " + method.getDeclaringClass()
.getName());
method.invoke(null);
} catch (IllegalAccessException | InvocationTargetException e) {
GTNHModifyMod.LOG.debug("An error occurred while executing handler. Reason: " + e.getMessage());
Expand All @@ -45,5 +50,6 @@ public static void init() {
}

Strategy.postInit();
GTNHModifyMod.LOG.info("Complete processing the recipe");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import net.minecraft.item.ItemStack;

import com.github.wohaopa.GTNHModify.GTNHModifyMod;

import gregtech.api.util.GT_Recipe;

public abstract class Strategy {
Expand All @@ -25,6 +27,7 @@ public static void init() {
public static void setStrategy(String strategyName) {
Strategy strategy1 = instants.getOrDefault(strategyName, NONE);
if (strategy1 != strategy) {
GTNHModifyMod.LOG.info("New strategy enable: " + strategyName);
strategy1.changeFrom(strategy);
strategy = strategy1;
dirty = true;
Expand Down

0 comments on commit 59179f1

Please sign in to comment.