Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edc5608
commit 34dbe27
Showing
3 changed files
with
109 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
.../java/novamachina/exnihilosequentia/common/compat/crafttweaker/CrucibleRecipeManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package novamachina.exnihilosequentia.common.compat.crafttweaker; | ||
|
||
import com.blamejared.crafttweaker.api.CraftTweakerAPI; | ||
import com.blamejared.crafttweaker.api.annotations.ZenRegister; | ||
import com.blamejared.crafttweaker.api.managers.IRecipeManager; | ||
import com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe; | ||
import net.minecraft.item.crafting.IRecipeType; | ||
import net.minecraft.util.ResourceLocation; | ||
import novamachina.exnihilosequentia.api.crafting.crucible.CrucibleRecipe; | ||
import novamachina.exnihilosequentia.common.compat.crafttweaker.builder.ZenCrucibleRecipe; | ||
import novamachina.exnihilosequentia.common.utility.ExNihiloConstants; | ||
import org.openzen.zencode.java.ZenCodeType; | ||
|
||
@ZenRegister | ||
@ZenCodeType.Name("mods.exnihilosequentia.CrucibleRecipes") | ||
public class CrucibleRecipeManager implements IRecipeManager { | ||
|
||
@ZenCodeType.Method | ||
public ZenCrucibleRecipe create(String recipeId) { | ||
recipeId = fixRecipeName(recipeId); | ||
ResourceLocation resourceLocation = new ResourceLocation(ExNihiloConstants.ModIds.CRAFT_TWEAKER, recipeId); | ||
ZenCrucibleRecipe recipe = ZenCrucibleRecipe.builder(resourceLocation); | ||
CraftTweakerAPI.apply(new ActionAddRecipe(this, recipe.build(), "")); | ||
return recipe; | ||
} | ||
|
||
@Override | ||
public IRecipeType<CrucibleRecipe> getRecipeType() { | ||
return CrucibleRecipe.RECIPE_TYPE; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...a/novamachina/exnihilosequentia/common/compat/crafttweaker/builder/ZenCrucibleRecipe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package novamachina.exnihilosequentia.common.compat.crafttweaker.builder; | ||
|
||
import com.blamejared.crafttweaker.api.annotations.ZenRegister; | ||
import com.blamejared.crafttweaker.api.fluid.IFluidStack; | ||
import com.blamejared.crafttweaker.api.item.IIngredient; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.crafting.Ingredient; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.fluids.FluidStack; | ||
import novamachina.exnihilosequentia.api.crafting.crucible.CrucibleRecipe; | ||
import novamachina.exnihilosequentia.common.tileentity.crucible.CrucilbeTypeEnum; | ||
import org.openzen.zencode.java.ZenCodeType; | ||
|
||
@ZenRegister | ||
@ZenCodeType.Name("mods.exnihilosequentia.ZenCrucibleRecipe") | ||
public class ZenCrucibleRecipe { | ||
|
||
private CrucibleRecipe internal; | ||
|
||
private ZenCrucibleRecipe(ResourceLocation recipeId) { | ||
this.internal = new CrucibleRecipe(recipeId, Ingredient.EMPTY, 0, FluidStack.EMPTY, CrucilbeTypeEnum.WOOD); | ||
} | ||
|
||
@ZenCodeType.Method | ||
public static ZenCrucibleRecipe builder(ResourceLocation recipeId) { | ||
return new ZenCrucibleRecipe(recipeId); | ||
} | ||
|
||
@ZenCodeType.Method | ||
public ZenCrucibleRecipe setInput(IIngredient input) { | ||
internal.setInput(input.asVanillaIngredient()); | ||
return this; | ||
} | ||
|
||
@ZenCodeType.Method | ||
public ZenCrucibleRecipe setAmount(int amount) { | ||
internal.setAmount(amount); | ||
return this; | ||
} | ||
|
||
@ZenCodeType.Method | ||
public ZenCrucibleRecipe setResultFluid(IFluidStack fluid) { | ||
internal.setResultFluid(fluid.getInternal()); | ||
return this; | ||
} | ||
|
||
@ZenCodeType.Method | ||
public ZenCrucibleRecipe setCrucibleType(String crucibleType) { | ||
internal.setCrucibleType(crucibleType); | ||
return this; | ||
} | ||
|
||
public CrucibleRecipe build() { | ||
return internal; | ||
} | ||
} |