mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-25 14:24:28 +00:00
Update IC2 support to version 2.2.756
* Added support for recipes to * Blast Furnace * Block Cutter * Added ability to specify fuels for Fluid Heat Generator
This commit is contained in:
1 parent
85a8b09ea1
commit
5e3babe90a
8 files changed
+235
-2
No files matched your search
@@ -30,7 +30,7 @@ dependencies {
|
||||
compile project(':ZenScript')
|
||||
compile project(':MineTweaker3-API')
|
||||
compile project(':MineTweaker3-MC1710-Main')
|
||||
compile files('libs/industrialcraft-2-2.2.491-experimental-api.jar')
|
||||
compile files('libs/industrialcraft-2-2.2.756-experimental-api.jar')
|
||||
}
|
||||
|
||||
task makeRegistry(type: RegisterZenClassesTask) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.mods.ic2.machines;
|
||||
|
||||
import ic2.api.recipe.RecipeOutput;
|
||||
import ic2.api.recipe.Recipes;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack;
|
||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
|
||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks;
|
||||
import minetweaker.mods.ic2.IC2RecipeInput;
|
||||
import minetweaker.mods.ic2.MachineAddRecipeAction;
|
||||
import stanhebben.zenscript.annotations.NotNull;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
* Provides access to the IC2 Blast Furnace recipes.
|
||||
*
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.ic2.BlastFurnace")
|
||||
@ModOnly("IC2")
|
||||
public class BlastFurnace {
|
||||
/**
|
||||
* Adds a new recipe to the blast furnace.
|
||||
*
|
||||
* The recipe input can be any pattern, as long as the stack size is determined.
|
||||
* The output can be any item stack.
|
||||
*
|
||||
* @param output recipe output
|
||||
* @param ingredient recipe input
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(
|
||||
@NotNull IItemStack output,
|
||||
@NotNull IIngredient ingredient) {
|
||||
if (ingredient.getAmount() < 0) {
|
||||
MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known");
|
||||
} else {
|
||||
MineTweakerAPI.apply(new MachineAddRecipeAction(
|
||||
"blast furnace",
|
||||
Recipes.blastfurance,
|
||||
getItemStacks(output),
|
||||
null,
|
||||
new IC2RecipeInput(ingredient)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the recipe output for the given input. Will return the output
|
||||
* of a single item, even if the stack contains multiple items.
|
||||
*
|
||||
* @param input recipe input
|
||||
* @return recipe output
|
||||
*/
|
||||
@ZenMethod
|
||||
public static IItemStack getOutput(
|
||||
@NotNull IItemStack input) {
|
||||
RecipeOutput output = Recipes.blastfurance.getOutputFor(getItemStack(input), false);
|
||||
if (output == null || output.items.isEmpty()) return null;
|
||||
return getIItemStack(output.items.get(0));
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.mods.ic2.machines;
|
||||
|
||||
import ic2.api.recipe.RecipeOutput;
|
||||
import ic2.api.recipe.Recipes;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack;
|
||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
|
||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks;
|
||||
import minetweaker.mods.ic2.IC2RecipeInput;
|
||||
import minetweaker.mods.ic2.MachineAddRecipeAction;
|
||||
import stanhebben.zenscript.annotations.NotNull;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
* Provides access to the IC2 Block Cutter recipes.
|
||||
*
|
||||
* @author Stan Hebben
|
||||
*/
|
||||
@ZenClass("mods.ic2.BlockCutter")
|
||||
@ModOnly("IC2")
|
||||
public class BlockCutter {
|
||||
/**
|
||||
* Adds a new recipe to the block cutter.
|
||||
*
|
||||
* The recipe input can be any pattern, as long as the stack size is determined.
|
||||
* The output can be any item stack.
|
||||
*
|
||||
* @param output recipe output
|
||||
* @param ingredient recipe input
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(
|
||||
@NotNull IItemStack output,
|
||||
@NotNull IIngredient ingredient) {
|
||||
if (ingredient.getAmount() < 0) {
|
||||
MineTweakerAPI.logWarning("invalid ingredient: " + ingredient + " - stack size not known");
|
||||
} else {
|
||||
MineTweakerAPI.apply(new MachineAddRecipeAction(
|
||||
"block cutter",
|
||||
Recipes.blockcutter,
|
||||
getItemStacks(output),
|
||||
null,
|
||||
new IC2RecipeInput(ingredient)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the recipe output for the given input. Will return the output
|
||||
* of a single item, even if the stack contains multiple items.
|
||||
*
|
||||
* @param input recipe input
|
||||
* @return recipe output
|
||||
*/
|
||||
@ZenMethod
|
||||
public static IItemStack getOutput(
|
||||
@NotNull IItemStack input) {
|
||||
RecipeOutput output = Recipes.blockcutter.getOutputFor(getItemStack(input), false);
|
||||
if (output == null || output.items.isEmpty()) return null;
|
||||
return getIItemStack(output.items.get(0));
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.mods.ic2.machines;
|
||||
|
||||
import ic2.api.recipe.Recipes;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.OneWayAction;
|
||||
import minetweaker.annotations.ModOnly;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
* Add a fluid to the fluid heat generator
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("mods.ic2.FluidHeatGenerator")
|
||||
@ModOnly("IC2")
|
||||
public class FluidHeatGenerator {
|
||||
@ZenMethod
|
||||
public static void addFluid(ILiquidStack liquidPerTick, int heatPerTick) {
|
||||
MineTweakerAPI.apply(new AddFluidAction(liquidPerTick.getName(), liquidPerTick.getAmount(), heatPerTick));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static boolean accepts(ILiquidStack liquid) {
|
||||
return Recipes.FluidHeatGenerator.acceptsFluid(FluidRegistry.getFluid(liquid.getName()));
|
||||
}
|
||||
|
||||
private static class AddFluidAction extends OneWayAction {
|
||||
private final String name;
|
||||
private final int liquidPerTick;
|
||||
private final int heatPerTick;
|
||||
|
||||
public AddFluidAction(String name, int liquidPerTick, int heatPerTick) {
|
||||
this.name = name;
|
||||
this.liquidPerTick = liquidPerTick;
|
||||
this.heatPerTick = heatPerTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
Recipes.FluidHeatGenerator.addFluid(name, liquidPerTick, heatPerTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding liquid " + name + " as fluid heat generator fuel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 47 * hash + this.liquidPerTick;
|
||||
hash = 47 * hash + this.heatPerTick;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final AddFluidAction other = (AddFluidAction) obj;
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if (this.liquidPerTick != other.liquidPerTick) {
|
||||
return false;
|
||||
}
|
||||
if (this.heatPerTick != other.heatPerTick) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@ import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* Add a fluid to the semi-fluid generator
|
||||
* @author Stan
|
||||
*/
|
||||
@ZenClass("mods.ic2.SemiFluidGenerator")
|
||||
|
||||
Reference in new issue
Block a user