aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kubatech/loaders
diff options
context:
space:
mode:
authorJakub <53441451+kuba6000@users.noreply.github.com>2023-01-14 23:55:05 +0100
committerGitHub <noreply@github.com>2023-01-14 23:55:05 +0100
commit429b77f05ad6bcde9364aa01b31f077316b3e154 (patch)
tree9872f88b32e904989b216732e11baff74b736c7b /src/main/java/kubatech/loaders
parent867280556692363d6ec183ac9838ab3c7769cf1c (diff)
downloadGT5-Unofficial-429b77f05ad6bcde9364aa01b31f077316b3e154.tar.gz
GT5-Unofficial-429b77f05ad6bcde9364aa01b31f077316b3e154.tar.bz2
GT5-Unofficial-429b77f05ad6bcde9364aa01b31f077316b3e154.zip
Fix Ultimate Tea Research (#44)
* Trigger after MT Reload * Update MTLoader.java
Diffstat (limited to 'src/main/java/kubatech/loaders')
-rw-r--r--src/main/java/kubatech/loaders/MTLoader.java25
-rw-r--r--src/main/java/kubatech/loaders/TCLoader.java77
2 files changed, 69 insertions, 33 deletions
diff --git a/src/main/java/kubatech/loaders/MTLoader.java b/src/main/java/kubatech/loaders/MTLoader.java
new file mode 100644
index 0000000000..5a1d620cac
--- /dev/null
+++ b/src/main/java/kubatech/loaders/MTLoader.java
@@ -0,0 +1,25 @@
+package kubatech.loaders;
+
+import kubatech.Tags;
+import kubatech.api.LoaderReference;
+import minetweaker.MineTweakerImplementationAPI;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class MTLoader {
+
+ private static final Logger LOG = LogManager.getLogger(Tags.MODID + "[MT Loader]");
+ public static MTLoader instance = null;
+
+ public static void init() {
+ if (instance == null) {
+ instance = new MTLoader();
+ MineTweakerImplementationAPI.onPostReload(instance::MTOnPostReload);
+ }
+ }
+
+ public void MTOnPostReload(MineTweakerImplementationAPI.ReloadEvent reloadEvent) {
+ LOG.info("MT Recipes Loaded!");
+ if (LoaderReference.Thaumcraft) TCLoader.register();
+ }
+}
diff --git a/src/main/java/kubatech/loaders/TCLoader.java b/src/main/java/kubatech/loaders/TCLoader.java
index 3c4980f251..95d215b37d 100644
--- a/src/main/java/kubatech/loaders/TCLoader.java
+++ b/src/main/java/kubatech/loaders/TCLoader.java
@@ -26,11 +26,16 @@ public class TCLoader {
public static void load() {}
- public static void lateLoad() {
- if (lateLoaded) return;
- lateLoaded = true;
+ public static void register() {
if (!LoaderReference.GTNHCoreMod || !LoaderReference.DraconicEvolution) return;
+ registerRecipe();
+ registerResearch();
+ }
+
+ private static InfusionRecipe ultimateTeaRecipe = null;
+ private static void registerRecipe() {
+ if (ultimateTeaRecipe != null) return;
final ItemStack[] components = new ItemStack[] {
// ItemList.LegendaryBlackTea.get(1),
// ItemList.LegendaryButterflyTea.get(1),
@@ -60,7 +65,6 @@ public class TCLoader {
.map(stack -> ItemID.create_NoCopy(stack, true, false, true))
.collect(Collectors.toCollection(HashSet::new));
- InfusionRecipe ultimateTeaRecipe;
//noinspection unchecked
ThaumcraftApi.getCraftingRecipes()
.add(
@@ -92,34 +96,41 @@ public class TCLoader {
return hashedInputs.containsAll(componentsHashed);
}
});
- ResearchItem research =
- new ResearchItem(
- "KT_UltimateTea",
- "NEWHORIZONS",
- new AspectList()
- .add(Aspect.MAGIC, 1)
- .add(Aspect.HEAL, 1)
- .add(Aspect.PLANT, 1)
- .add(Aspect.EXCHANGE, 1),
- -2,
- 4,
- 2,
- ItemList.LegendaryUltimateTea.get(1)) {
- @Override
- public String getName() {
- return TeaUltimate.getUltimateTeaDisplayName(super.getName());
- }
- };
- research.setPages(
- new ResearchPage("KT.research.ultimatetea") {
- @Override
- public String getTranslatedText() {
- return TeaUltimate.getUltimateTeaDisplayName(super.getTranslatedText());
- }
- },
- new ResearchPage(ultimateTeaRecipe));
- research.setParents("INFUSION", "DEZILSMARSHMALLOW");
- ThaumcraftApi.addWarpToResearch("KT_UltimateTea", 20);
- ResearchCategories.addResearch(research);
+ }
+
+ private static ResearchItem ultimateTeaResearch = null;
+
+ private static void registerResearch() {
+ if (ultimateTeaResearch == null) {
+ ultimateTeaResearch =
+ new ResearchItem(
+ "KT_UltimateTea",
+ "NEWHORIZONS",
+ new AspectList()
+ .add(Aspect.MAGIC, 1)
+ .add(Aspect.HEAL, 1)
+ .add(Aspect.PLANT, 1)
+ .add(Aspect.EXCHANGE, 1),
+ -2,
+ 4,
+ 2,
+ ItemList.LegendaryUltimateTea.get(1)) {
+ @Override
+ public String getName() {
+ return TeaUltimate.getUltimateTeaDisplayName(super.getName());
+ }
+ };
+ ultimateTeaResearch.setPages(
+ new ResearchPage("KT.research.ultimatetea") {
+ @Override
+ public String getTranslatedText() {
+ return TeaUltimate.getUltimateTeaDisplayName(super.getTranslatedText());
+ }
+ },
+ new ResearchPage(ultimateTeaRecipe));
+ ultimateTeaResearch.setParents("INFUSION", "DEZILSMARSHMALLOW");
+ ThaumcraftApi.addWarpToResearch("KT_UltimateTea", 20);
+ }
+ ResearchCategories.addResearch(ultimateTeaResearch);
}
}