-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for smithing table recipes.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/main/java/com/blamejared/crafttweaker/impl/managers/CTSmithingManager.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,54 @@ | ||
package com.blamejared.crafttweaker.impl.managers; | ||
|
||
import org.openzen.zencode.java.ZenCodeGlobals; | ||
import org.openzen.zencode.java.ZenCodeType; | ||
|
||
import com.blamejared.crafttweaker.CraftTweaker; | ||
import com.blamejared.crafttweaker.api.CraftTweakerAPI; | ||
import com.blamejared.crafttweaker.api.annotations.ZenRegister; | ||
import com.blamejared.crafttweaker.api.item.IIngredient; | ||
import com.blamejared.crafttweaker.api.item.IItemStack; | ||
import com.blamejared.crafttweaker.api.managers.IRecipeManager; | ||
import com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe; | ||
import com.blamejared.crafttweaker_annotations.annotations.Document; | ||
|
||
import net.minecraft.item.crafting.IRecipeType; | ||
import net.minecraft.item.crafting.SmithingRecipe; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
/** | ||
* @docParam this smithing | ||
*/ | ||
@ZenRegister | ||
@ZenCodeType.Name("crafttweaker.api.SmithingManager") | ||
@Document("vanilla/api/managers/SmithingManager") | ||
public class CTSmithingManager implements IRecipeManager { | ||
|
||
@ZenCodeGlobals.Global("smithing") | ||
public static final CTSmithingManager INSTANCE = new CTSmithingManager(); | ||
|
||
/** | ||
* Adds a recipe to the smithing table. | ||
* | ||
* @param recipeName Name of the recipe. | ||
* @param result The item created by the recipe. | ||
* @param base The initial ingredient for the recipe. | ||
* @param addition The item added to the base item. | ||
* | ||
* @docParam recipeName "recipe_name" | ||
* @docParam result <item:minecraft:golden_apple> | ||
* @docParam base <item:minecraft:apple> | ||
* @docParam addition <tag:forge:ingots/gold> | ||
*/ | ||
@ZenCodeType.Method | ||
public void addRecipe(String recipeName, IItemStack result, IIngredient base, IIngredient addition) { | ||
recipeName = validateRecipeName(recipeName); | ||
final SmithingRecipe smithing = new SmithingRecipe(new ResourceLocation(CraftTweaker.MODID, recipeName), base.asVanillaIngredient(), addition.asVanillaIngredient(), result.getInternal()); | ||
CraftTweakerAPI.apply(new ActionAddRecipe(this, smithing, "")); | ||
} | ||
|
||
@Override | ||
public IRecipeType<?> getRecipeType() { | ||
return IRecipeType.SMITHING; | ||
} | ||
} |