TechReborn/src/main/java/techreborn/compat/crafttweaker/CTIndustrialGrinder.java

112 lines
4.6 KiB
Java
Raw Normal View History

/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
2017-03-14 13:59:17 +01:00
package techreborn.compat.crafttweaker;
2017-06-28 21:50:00 +02:00
import crafttweaker.CraftTweakerAPI;
import crafttweaker.api.item.IIngredient;
import crafttweaker.api.item.IItemStack;
import crafttweaker.api.liquid.ILiquidStack;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import techreborn.api.Reference;
2017-01-16 11:06:11 +01:00
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
/**
* Craftweaker class to change Industrial Grinder recipes.
*/
@ZenClass("mods.techreborn.industrialGrinder")
2017-03-14 13:59:17 +01:00
public class CTIndustrialGrinder extends CTGeneric {
2015-11-21 09:54:26 +01:00
/**
* Add recipe for Industrial Grinder
* @param output1 ItemStack First recipe output
* @param output2 ItemStack Second recipe output
* @param output3 ItemStack Third recipe output
* @param output4 ItemStack Fourth recipe output
* @param input1 First recipe input
* @param input2 Second recipe input. Not used )
* @param ticktime Amount of ticks to complete crafting
* @param euTick Amount of EU per tick consumed during crafting
*/
2016-10-08 21:46:16 +02:00
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
addRecipe(output1, output2, output3, output4, input1, input2, null, ticktime, euTick);
}
2015-11-21 09:54:26 +01:00
/**
* Add recipe for Industrial Grinder
* @param output1 ItemStack First recipe output
* @param output2 ItemStack Second recipe output
* @param output3 ItemStack Third recipe output
* @param output4 ItemStack Fourth recipe output
* @param input1 First recipe input
* @param input2 Second recipe input. Not used )
* @param fluid LiquidStack Liquid used for grinding
* @param ticktime Amount of ticks to complete crafting
* @param euTick Amount of EU per tick consumed during crafting
*/
2016-10-08 21:46:16 +02:00
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick) {
2017-03-14 13:59:17 +01:00
ItemStack oInput1 = (ItemStack) CraftTweakerCompat.toObject(input1);
// There is only one input slot in Industrial Grinder
//ItemStack oInput2 = (ItemStack) CraftTweakerCompat.toObject(input2);
2016-10-08 21:46:16 +02:00
FluidStack fluidStack = null;
if (fluid != null) {
2017-03-14 13:59:17 +01:00
fluidStack = CraftTweakerCompat.toFluidStack(fluid);
2016-10-08 21:46:16 +02:00
}
2017-06-12 15:23:32 +02:00
IndustrialGrinderRecipe r = new IndustrialGrinderRecipe(oInput1, fluidStack, CraftTweakerCompat.toStack(output1), CraftTweakerCompat.toStack(output2), CraftTweakerCompat.toStack(output3), CraftTweakerCompat.toStack(output4), ticktime, euTick);
2017-01-16 11:06:11 +01:00
addRecipe(r);
2016-10-08 21:46:16 +02:00
}
/**
* Remove recipe for Industrial Grinder based on input ingredient
* @param iIngredient Recipe input for which we should remove recipe
*/
2016-10-08 21:46:16 +02:00
@ZenMethod
public static void removeInputRecipe(IIngredient iIngredient) { CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName())); }
/**
* Remove recipe for Industrial Grinder based on output
* @param output Recipe output for which we should remove recipe
*/
2016-10-08 21:46:16 +02:00
@ZenMethod
public static void removeRecipe(IItemStack output) {
2017-06-28 21:50:00 +02:00
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
2016-10-08 21:46:16 +02:00
}
2015-11-21 09:54:26 +01:00
/**
* Get reference machine name
* @return String Reference name for Industrial Grinder
*/
2016-10-08 21:46:16 +02:00
public static String getMachineName() {
return Reference.industrialGrinderRecipe;
}
}