mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-21 12:52:23 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
0cc3fa06c2
commit
655636b7e9
231 files changed
+10024
-8585
No files matched your search
@@ -11,8 +11,10 @@ import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.helpers.StackHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
@@ -20,71 +22,76 @@ import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
|
||||
@ZenClass("mods.botania.PureDaisy")
|
||||
public class PureDaisy {
|
||||
|
||||
|
||||
public static final String name = "Botania PureDaisy";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IIngredient blockInput, IItemStack blockOutput) {
|
||||
if(blockInput == null || blockOutput == null) {
|
||||
if (blockInput == null || blockOutput == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Object input = InputHelper.toObject(blockInput);
|
||||
|
||||
if(input == null || (input instanceof ItemStack && !InputHelper.isABlock((ItemStack)input))) {
|
||||
|
||||
if (input == null || (input instanceof ItemStack && !InputHelper.isABlock((ItemStack) input))) {
|
||||
LogHelper.logError(String.format("Input must be a block or an oredict entry."));
|
||||
return;
|
||||
}
|
||||
|
||||
if(input instanceof ItemStack) input = Block.getBlockFromItem(((ItemStack)input).getItem());
|
||||
|
||||
if (input instanceof ItemStack) input = Block.getBlockFromItem(((ItemStack) input).getItem());
|
||||
ItemStack output = InputHelper.toStack(blockOutput);
|
||||
|
||||
RecipePureDaisy recipe = new RecipePureDaisy(input, Block.getBlockFromItem(output.getItem()), output.getItemDamage());
|
||||
|
||||
|
||||
RecipePureDaisy recipe = new RecipePureDaisy(
|
||||
input,
|
||||
Block.getBlockFromItem(output.getItem()),
|
||||
output.getItemDamage());
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
|
||||
private static class Add extends BaseListAddition<RecipePureDaisy> {
|
||||
|
||||
public Add(RecipePureDaisy recipe) {
|
||||
super(PureDaisy.name, BotaniaAPI.pureDaisyRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(RecipePureDaisy recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<RecipePureDaisy> recipes = new LinkedList<RecipePureDaisy>();
|
||||
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
|
||||
for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
IItemStack out = InputHelper.toIItemStack(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()));
|
||||
|
||||
if(StackHelper.matches(output, out)) {
|
||||
|
||||
if (StackHelper.matches(output, out)) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipePureDaisy> {
|
||||
|
||||
public Remove(List<RecipePureDaisy> recipes) {
|
||||
super(PureDaisy.name, BotaniaAPI.pureDaisyRecipes, recipes);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(RecipePureDaisy recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getOutput(), 1, recipe.getOutputMeta()));
|
||||
|
||||
Reference in new issue
Block a user