From d4a9c12added8a9552533471c77305fa51ec3b55 Mon Sep 17 00:00:00 2001 From: Jared Date: Tue, 25 Jul 2017 22:56:09 +0200 Subject: [PATCH] Added ActuallyAdditions support --- build.gradle | 5 ++ .../actuallyaddition/AtomicReconstructor.java | 63 ++++++++++++++++ .../compat/actuallyaddition/BallOfFur.java | 65 +++++++++++++++++ .../compat/actuallyaddition/Compost.java | 72 +++++++++++++++++++ .../compat/actuallyaddition/Crusher.java | 68 ++++++++++++++++++ .../compat/actuallyaddition/Empowerer.java | 71 ++++++++++++++++++ .../actuallyaddition/TreasureChest.java | 64 +++++++++++++++++ 7 files changed, 408 insertions(+) create mode 100644 src/main/java/com/blamejared/compat/actuallyaddition/AtomicReconstructor.java create mode 100644 src/main/java/com/blamejared/compat/actuallyaddition/BallOfFur.java create mode 100644 src/main/java/com/blamejared/compat/actuallyaddition/Compost.java create mode 100644 src/main/java/com/blamejared/compat/actuallyaddition/Crusher.java create mode 100644 src/main/java/com/blamejared/compat/actuallyaddition/Empowerer.java create mode 100644 src/main/java/com/blamejared/compat/actuallyaddition/TreasureChest.java diff --git a/build.gradle b/build.gradle index c7e1044..289957d 100644 --- a/build.gradle +++ b/build.gradle @@ -42,6 +42,9 @@ repositories { maven { url "http://www.ryanliptak.com/maven/" } + maven { + url "https://maven.chaosfield.at/" + } } dependencies { @@ -49,6 +52,8 @@ dependencies { deobfCompile "com.blamejared:MTLib:3.0.0.1" deobfCompile "cofh:ThermalExpansion:1.12-5.3.3.15:deobf" deobfCompile "betterwithmods:BetterWithMods:1.12-1.3.7-14" + deobfCompile "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12-r113" + } processResources { diff --git a/src/main/java/com/blamejared/compat/actuallyaddition/AtomicReconstructor.java b/src/main/java/com/blamejared/compat/actuallyaddition/AtomicReconstructor.java new file mode 100644 index 0000000..e0561cc --- /dev/null +++ b/src/main/java/com/blamejared/compat/actuallyaddition/AtomicReconstructor.java @@ -0,0 +1,63 @@ +package com.blamejared.compat.actuallyaddition; + +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.*; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.*; +import crafttweaker.api.item.IItemStack; +import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; +import stanhebben.zenscript.annotations.*; + +import java.util.*; + +@ZenClass("mods.actuallyadditions.AtomicReconstructor") +@Handler("actuallyadditions") +public class AtomicReconstructor { + + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int energyUsed) { + ModTweaker.LATE_ADDITIONS.add(new Add(Collections.singletonList(new LensConversionRecipe(InputHelper.toStack(input), InputHelper.toStack(output), energyUsed, ActuallyAdditionsAPI.lensDefaultConversion)))); + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + ModTweaker.LATE_ADDITIONS.add(new Remove(output)); + } + + private static class Add extends BaseListAddition { + + protected Add(List recipies) { + super("Atomic Reconstructor", ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES, recipies); + } + + @Override + protected String getRecipeInfo(LensConversionRecipe recipe) { + return LogHelper.getStackDescription(recipe.outputStack); + } + + } + + private static class Remove extends BaseListRemoval { + + private IItemStack output; + + protected Remove(IItemStack output) { + super("Atomic Reconstructor", ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES); + this.output = output; + } + + @Override + public void apply() { + ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES.stream().filter(recipe -> output.matches(InputHelper.toIItemStack(recipe.outputStack))).forEach(recipes::add); + super.apply(); + } + + @Override + protected String getRecipeInfo(LensConversionRecipe recipe) { + return LogHelper.getStackDescription(recipe.outputStack); + } + + } + +} \ No newline at end of file diff --git a/src/main/java/com/blamejared/compat/actuallyaddition/BallOfFur.java b/src/main/java/com/blamejared/compat/actuallyaddition/BallOfFur.java new file mode 100644 index 0000000..07d13ce --- /dev/null +++ b/src/main/java/com/blamejared/compat/actuallyaddition/BallOfFur.java @@ -0,0 +1,65 @@ +package com.blamejared.compat.actuallyaddition; + +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.*; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.*; +import crafttweaker.api.item.IItemStack; +import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.recipe.BallOfFurReturn; +import stanhebben.zenscript.annotations.*; + +import java.util.*; + +@ZenClass("mods.actuallyadditions.BallOfFur") +@Handler("actuallyadditions") +public class BallOfFur { + + @ZenMethod + public static void addReturn(IItemStack output, int chance) { + ModTweaker.LATE_ADDITIONS.add(new Add(Collections.singletonList(new BallOfFurReturn(InputHelper.toStack(output), chance)))); + } + + @ZenMethod + public static void removeReturn(IItemStack output) { + ModTweaker.LATE_ADDITIONS.add(new Remove(output)); + } + + private static class Add extends BaseListAddition { + + protected Add(List recipes) { + super("BallOfFur", ActuallyAdditionsAPI.BALL_OF_FUR_RETURN_ITEMS, recipes); + } + + @Override + protected String getRecipeInfo(BallOfFurReturn recipe) { + return LogHelper.getStackDescription(recipe.returnItem); + } + } + + private static class Remove extends BaseListRemoval { + + private IItemStack output; + + public Remove(IItemStack output) { + super("BallOfFur", ActuallyAdditionsAPI.BALL_OF_FUR_RETURN_ITEMS); + this.output = output; + } + + @Override + public void apply() { + for(BallOfFurReturn recipe : ActuallyAdditionsAPI.BALL_OF_FUR_RETURN_ITEMS) { + if(output.matches(InputHelper.toIItemStack(recipe.returnItem))) { + recipes.add(recipe); + } + } + super.apply(); + } + + @Override + protected String getRecipeInfo(BallOfFurReturn recipe) { + return LogHelper.getStackDescription(recipe.returnItem); + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/blamejared/compat/actuallyaddition/Compost.java b/src/main/java/com/blamejared/compat/actuallyaddition/Compost.java new file mode 100644 index 0000000..500ba1d --- /dev/null +++ b/src/main/java/com/blamejared/compat/actuallyaddition/Compost.java @@ -0,0 +1,72 @@ +package com.blamejared.compat.actuallyaddition; + +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.*; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.*; +import crafttweaker.CraftTweakerAPI; +import crafttweaker.api.item.IItemStack; +import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe; +import net.minecraft.block.Block; +import stanhebben.zenscript.annotations.*; + +import java.util.*; + +@ZenClass("mods.actuallyadditions.Compost") +@Handler("actuallyadditions") +public class Compost { + + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack outputDisplay, IItemStack input, IItemStack inputDisplay) { + if(!InputHelper.isABlock(outputDisplay) || !InputHelper.isABlock(inputDisplay)) { + CraftTweakerAPI.logError("outputDisplay or InputDisplay is not a block!"); + return; + } + ModTweaker.LATE_ADDITIONS.add(new Add(Collections.singletonList(new CompostRecipe(InputHelper.toStack(input), Block.getBlockFromItem(InputHelper.toStack(inputDisplay).getItem()), InputHelper.toStack(output), Block.getBlockFromItem(InputHelper.toStack(outputDisplay).getItem()))))); + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + + ModTweaker.LATE_REMOVALS.add(new Remove(output)); + } + + private static class Add extends BaseListAddition { + + protected Add(List recipes) { + super("Compost", ActuallyAdditionsAPI.COMPOST_RECIPES, recipes); + } + + @Override + public String getRecipeInfo(CompostRecipe recipe) { + return LogHelper.getStackDescription(recipe.output); + } + } + + private static class Remove extends BaseListRemoval { + + private IItemStack output; + + protected Remove(IItemStack output) { + super("Compost", ActuallyAdditionsAPI.COMPOST_RECIPES); + this.output = output; + } + + @Override + public void apply() { + for(CompostRecipe recipe : ActuallyAdditionsAPI.COMPOST_RECIPES) { + System.out.println(output); + if(output.matches(InputHelper.toIItemStack(recipe.output))) { + recipes.add(recipe); + } + } + super.apply(); + } + + @Override + public String getRecipeInfo(CompostRecipe recipe) { + return LogHelper.getStackDescription(recipe.output); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/blamejared/compat/actuallyaddition/Crusher.java b/src/main/java/com/blamejared/compat/actuallyaddition/Crusher.java new file mode 100644 index 0000000..5b66d0f --- /dev/null +++ b/src/main/java/com/blamejared/compat/actuallyaddition/Crusher.java @@ -0,0 +1,68 @@ +package com.blamejared.compat.actuallyaddition; + +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.*; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.*; +import crafttweaker.api.item.IItemStack; +import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.*; + +import java.util.*; + +@Handler("actuallyadditions") +@ZenClass("mods.actuallyadditions.Crusher") +public class Crusher { + + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, @Optional IItemStack outputSecondary, @Optional int outputSecondaryChance) { + ModTweaker.LATE_ADDITIONS.add(new Add(Collections.singletonList(new CrusherRecipe(InputHelper.toStack(input), InputHelper.toStack(output), InputHelper.toStack(outputSecondary), outputSecondaryChance)))); + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + ModTweaker.LATE_REMOVALS.add(new Remove(output)); + } + + private static class Add extends BaseListAddition { + + protected Add(List recipes) { + super("Crusher", ActuallyAdditionsAPI.CRUSHER_RECIPES, recipes); + } + + @Override + public String getRecipeInfo(CrusherRecipe recipe) { + return LogHelper.getStackDescription(recipe.inputStack); + } + + } + + private static class Remove extends BaseListRemoval { + + private IItemStack output; + + protected Remove(IItemStack output) { + super("Crusher", ActuallyAdditionsAPI.CRUSHER_RECIPES); + this.output = output; + } + + @Override + public void apply() { + ActuallyAdditionsAPI.CRUSHER_RECIPES.forEach(recipe -> { + if(output.matches(InputHelper.toIItemStack(recipe.outputOneStack))) { + recipes.add(recipe); + } + }); + super.apply(); + } + + @Override + public String getRecipeInfo(CrusherRecipe recipe) { + return LogHelper.getStackDescription(recipe.outputOneStack); + } + + } + +} \ No newline at end of file diff --git a/src/main/java/com/blamejared/compat/actuallyaddition/Empowerer.java b/src/main/java/com/blamejared/compat/actuallyaddition/Empowerer.java new file mode 100644 index 0000000..84f35d9 --- /dev/null +++ b/src/main/java/com/blamejared/compat/actuallyaddition/Empowerer.java @@ -0,0 +1,71 @@ +package com.blamejared.compat.actuallyaddition; + +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.*; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.*; +import crafttweaker.api.item.IItemStack; +import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.*; + +import java.util.*; + +@ZenClass("mods.actuallyadditions.Empowerer") +@Handler("actuallyadditions") +public class Empowerer { + + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, IItemStack modifier1, IItemStack modifier2, IItemStack modifier3, IItemStack modifier4, int energyPerStand, int time, @Optional float[] particleColourArray) { + if(particleColourArray == null || particleColourArray.length == 0) { + particleColourArray = new float[]{0, 0, 0}; + } + ModTweaker.LATE_ADDITIONS.add(new Add(Collections.singletonList(new EmpowererRecipe(InputHelper.toStack(input), InputHelper.toStack(output), InputHelper.toStack(modifier1), InputHelper.toStack(modifier2), InputHelper.toStack(modifier3), InputHelper.toStack(modifier4), energyPerStand, time, particleColourArray)))); + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + ModTweaker.LATE_REMOVALS.add(new Remove(output)); + } + + private static class Add extends BaseListAddition { + + protected Add(List recipes) { + super("Empowerer", ActuallyAdditionsAPI.EMPOWERER_RECIPES, recipes); + } + + @Override + protected String getRecipeInfo(EmpowererRecipe recipe) { + return LogHelper.getStackDescription(recipe.output); + } + + } + + public static class Remove extends BaseListRemoval { + + private IItemStack output; + + protected Remove(IItemStack output) { + super("Empowerer", ActuallyAdditionsAPI.EMPOWERER_RECIPES); + this.output = output; + } + + @Override + public void apply() { + for(EmpowererRecipe recipe : ActuallyAdditionsAPI.EMPOWERER_RECIPES) { + if(output.matches(InputHelper.toIItemStack(recipe.output))) { + recipes.add(recipe); + } + } + super.apply(); + } + + @Override + protected String getRecipeInfo(EmpowererRecipe recipe) { + return LogHelper.getStackDescription(recipe.output); + } + + } + +} \ No newline at end of file diff --git a/src/main/java/com/blamejared/compat/actuallyaddition/TreasureChest.java b/src/main/java/com/blamejared/compat/actuallyaddition/TreasureChest.java new file mode 100644 index 0000000..0c472f3 --- /dev/null +++ b/src/main/java/com/blamejared/compat/actuallyaddition/TreasureChest.java @@ -0,0 +1,64 @@ +package com.blamejared.compat.actuallyaddition; + +import com.blamejared.ModTweaker; +import com.blamejared.api.annotations.*; +import com.blamejared.mtlib.helpers.*; +import com.blamejared.mtlib.utils.*; +import crafttweaker.api.item.IItemStack; +import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot; +import stanhebben.zenscript.annotations.*; + +import java.util.*; + +@ZenClass("mods.actuallyadditions.TreasureChest") +@Handler("actuallyadditions") +public class TreasureChest { + + @ZenMethod + public static void addLoot(IItemStack returnItem, int chance, int minAmount, int maxAmount) { + ModTweaker.LATE_ADDITIONS.add(new Add(Collections.singletonList(new TreasureChestLoot(InputHelper.toStack(returnItem), chance, minAmount, maxAmount)))); + } + + @ZenMethod + public static void removeLoot(IItemStack returnItem) { + ModTweaker.LATE_REMOVALS.add(new Remove(returnItem)); + } + + private static class Add extends BaseListAddition { + + protected Add(List recipes) { + super("Treasure Chest", ActuallyAdditionsAPI.TREASURE_CHEST_LOOT, recipes); + } + + @Override + protected String getRecipeInfo(TreasureChestLoot recipe) { + return LogHelper.getStackDescription(recipe.returnItem); + } + } + + private static class Remove extends BaseListRemoval { + + private IItemStack output; + + protected Remove(IItemStack output) { + super("Treasure Chest", ActuallyAdditionsAPI.TREASURE_CHEST_LOOT); + this.output = output; + } + + @Override + public void apply() { + ActuallyAdditionsAPI.TREASURE_CHEST_LOOT.forEach(recipe -> { + if(output.matches(InputHelper.toIItemStack(recipe.returnItem))) { + recipes.add(recipe); + } + }); + super.apply(); + } + + @Override + protected String getRecipeInfo(TreasureChestLoot recipe) { + return LogHelper.getStackDescription(recipe.returnItem); + } + } +} \ No newline at end of file