From 9ab5bd140678ddb6273b2826e0d640464e9c3ee9 Mon Sep 17 00:00:00 2001 From: Timo Ley Date: Sat, 4 Feb 2023 12:18:43 +0100 Subject: [PATCH] feat: crystal cluster research --- build.gradle | 4 +- .../classiccasting/ClassicCasting.java | 1 + .../anvilcraft/classiccasting/Recipes.java | 72 +++++++++++++++++++ .../anvilcraft/classiccasting/Research.java | 24 ++++++- .../assets/classiccasting/lang/en_US.lang | 6 +- 5 files changed, 103 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 287014e..990e6a3 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 -version = "1.2.0" +version = "1.3.0" group = "net.anvilcraft" archivesBaseName = "classic-casting" @@ -42,7 +42,7 @@ repositories { dependencies { implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf" - implementation "dev.tilera:auracore:1.7.4:deobf" + implementation "dev.tilera:auracore:1.8.5:deobf" implementation "com.github.tox1cozZ:mixin-booter-legacy:1.1.2" } diff --git a/src/main/java/net/anvilcraft/classiccasting/ClassicCasting.java b/src/main/java/net/anvilcraft/classiccasting/ClassicCasting.java index a5a1980..f191309 100644 --- a/src/main/java/net/anvilcraft/classiccasting/ClassicCasting.java +++ b/src/main/java/net/anvilcraft/classiccasting/ClassicCasting.java @@ -62,5 +62,6 @@ public class ClassicCasting { @Mod.EventHandler public void postInit(FMLPostInitializationEvent ev) { Research.init(); + Recipes.removeClusters(); } } diff --git a/src/main/java/net/anvilcraft/classiccasting/Recipes.java b/src/main/java/net/anvilcraft/classiccasting/Recipes.java index 2217c90..a5a6128 100644 --- a/src/main/java/net/anvilcraft/classiccasting/Recipes.java +++ b/src/main/java/net/anvilcraft/classiccasting/Recipes.java @@ -2,10 +2,13 @@ package net.anvilcraft.classiccasting; import dev.tilera.auracore.api.Aspects; import dev.tilera.auracore.api.AuracoreRecipes; +import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.oredict.ShapedOreRecipe; import thaumcraft.api.ThaumcraftApi; import thaumcraft.api.aspects.Aspect; @@ -343,5 +346,74 @@ public class Recipes { Items.ender_pearl ) ); + addClusters(); + } + + public static void addClusters() { + for (int i = 0; i <= 10; i++) { + if (i == 6 || i == 7 || i == 9) continue; + int k = i > 6 ? i - 1 : i; + Research.clusters[k] = AuracoreRecipes.addShapelessInfusionCraftingRecipe( + "CRYSTALCLUSTER" + i, + "CRYSTALCLUSTER", + 100, + new AspectList() + .add(Aspect.CRYSTAL, 8) + .add(Aspect.MAGIC, 8) + .add(Aspect.EXCHANGE, 8), + new ItemStack(ConfigBlocks.blockCrystal, 1, i), + new ItemStack(ConfigItems.itemShard, 1, k), + new ItemStack(ConfigItems.itemShard, 1, k), + new ItemStack(ConfigItems.itemShard, 1, k), + new ItemStack(ConfigItems.itemShard, 1, k), + new ItemStack(ConfigItems.itemShard, 1, k), + new ItemStack(ConfigItems.itemShard, 1, k) + ); + } + Research.clusters[6] = AuracoreRecipes.addShapelessInfusionCraftingRecipe( + "CRYSTALCLUSTER6", + "CRYSTALCLUSTER", + 100, + new AspectList() + .add(Aspect.CRYSTAL, 8) + .add(Aspect.MAGIC, 8) + .add(Aspect.EXCHANGE, 8), + new ItemStack(ConfigBlocks.blockCrystal, 1, 6), + new ItemStack(ConfigItems.itemShard, 1, 0), + new ItemStack(ConfigItems.itemShard, 1, 1), + new ItemStack(ConfigItems.itemShard, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 3), + new ItemStack(ConfigItems.itemShard, 1, 4), + new ItemStack(ConfigItems.itemShard, 1, 5) + ); + Research.clusters[8] = AuracoreRecipes.addShapelessInfusionCraftingRecipe( + "CRYSTALCLUSTER9", + "CRYSTALCLUSTER", + 100, + new AspectList() + .add(Aspect.CRYSTAL, 8) + .add(Aspect.MAGIC, 8) + .add(Aspect.EXCHANGE, 8), + new ItemStack(ConfigBlocks.blockCrystal, 1, 9), + new ItemStack(ConfigItems.itemShard, 1, 0), + new ItemStack(ConfigItems.itemShard, 1, 1), + new ItemStack(ConfigItems.itemShard, 1, 2), + new ItemStack(ConfigItems.itemShard, 1, 3), + new ItemStack(ConfigItems.itemShard, 1, 7) + ); + } + + @SuppressWarnings("unchecked") + public static void removeClusters() { + CraftingManager.getInstance().getRecipeList().removeIf((r) -> isCrystalCluster(r)); + } + + public static boolean isCrystalCluster(Object recipe) { + if (!(recipe instanceof IRecipe)) return false; + IRecipe r = (IRecipe) recipe; + ItemStack output = r.getRecipeOutput(); + if (output == null) return false; + Item item = output.getItem(); + return Block.getBlockFromItem(item) == ConfigBlocks.blockCrystal; } } diff --git a/src/main/java/net/anvilcraft/classiccasting/Research.java b/src/main/java/net/anvilcraft/classiccasting/Research.java index 5e81d43..f71d6c9 100644 --- a/src/main/java/net/anvilcraft/classiccasting/Research.java +++ b/src/main/java/net/anvilcraft/classiccasting/Research.java @@ -24,6 +24,7 @@ public class Research { public static List magnetStructure; public static Map arcaneRecipes = new HashMap<>(); public static Map infusionRecipes = new HashMap<>(); + public static IInfusionRecipe[] clusters = new IInfusionRecipe[10]; public static ItemStack empty = new ItemStack(ConfigBlocks.blockHole, 1, 15); public static void init() { @@ -164,7 +165,7 @@ public class Research { new ResearchPage("classiccasting.research_page.CRYSTALCORE.2"), new ResearchPage(magnetStructure) ) - .setParents("THETHEORYOFEVERYTHING") + .setParents("THETHEORYOFEVERYTHING", "CRYSTALCLUSTER") .registerResearchItem(); new ResearchItem( @@ -408,5 +409,26 @@ public class Research { ) .setParents("UNIFIEDTHAUMICFIELDTHEORY", "ENCHFABRIC") .registerResearchItem(); + + ResearchPage crystalPage = new ResearchPageInfusion(clusters); + crystalPage.recipeOutput = new ItemStack(ConfigBlocks.blockCrystal, 1, 9); + new ResearchItem( + "CRYSTALCLUSTER", + "CLASSICCASTING", + new AspectList() + .add(Aspect.CRYSTAL, 24) + .add(Aspect.MAGIC, 32) + .add(Aspect.EXCHANGE, 24), + -2, + 6, + 1, + new ItemStack(ConfigBlocks.blockCrystal, 1, 9) + ) + .setPages( + new ResearchPage("classiccasting.research_page.CRYSTALCLUSTER"), + crystalPage + ) + .setParents("BASICFLUX") + .registerResearchItem(); } } diff --git a/src/main/resources/assets/classiccasting/lang/en_US.lang b/src/main/resources/assets/classiccasting/lang/en_US.lang index 4fb9968..aebe97b 100644 --- a/src/main/resources/assets/classiccasting/lang/en_US.lang +++ b/src/main/resources/assets/classiccasting/lang/en_US.lang @@ -96,4 +96,8 @@ classiccasting.research_page.CCAURA.2=or by being recharged by infused ore nearb tc.research_name.CCFLUX=Flux tc.research_text.CCFLUX=When magic goes wrong classiccasting.research_page.CCFLUX.1=Using magic is never without risks and nothing proves this as much as Flux. If the magical aura can be described as a still pool, Flux is the ripples and eddies caused by a rock dropped into it. It is not a corruption of the magic, but a disturbance – order turning to chaos and the natural laws being turned on their head.
Luckily auras almost always strive for order and balance, and this usually means that Flux is purged from them in some way. The exact form this takes can vary vastly and depends on the type of flux present in the aura. The simplest and most common is the spontaneous generation -classiccasting.research_page.CCFLUX.2=of the magical creatures known as Wisps. Lightning strikes, storms or mysterious illnesses or boons can all be held as examples of Flux being purged from an aura.
Only the brave or foolish practices magic without keeping an eye on how much Flux they are letting loose into the environment. \ No newline at end of file +classiccasting.research_page.CCFLUX.2=of the magical creatures known as Wisps. Lightning strikes, storms or mysterious illnesses or boons can all be held as examples of Flux being purged from an aura.
Only the brave or foolish practices magic without keeping an eye on how much Flux they are letting loose into the environment. + +tc.research_name.CRYSTALCLUSTER=Crystal Clusters +tc.research_text.CRYSTALCLUSTER=Oooh, pretty! +classiccasting.research_page.CRYSTALCLUSTER=You have found a way to fuse the crystal shards into larger, more stable, crystalline clusters. These crystals thrum with magical energy and are quite pleasing to the eye.
These crystals seem to be able to slowly replenish nearby aura nodes and even boost their vis levels above their normal baseline levels to a limited degree. Of course that will probably lead to Flux build-up, but the benefits may outweigh the negative side-effects. \ No newline at end of file