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
a712e6b
commit dc3a061
Showing
14 changed files
with
444 additions
and
24 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
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
25 changes: 25 additions & 0 deletions
25
src/main/java/com/blamejared/crafttweaker/api/events/recipes/RegisterRecipeWritersEvent.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,25 @@ | ||
package com.blamejared.crafttweaker.api.events.recipes; | ||
|
||
import com.blamejared.crafttweaker.api.CraftTweakerAPI; | ||
import com.blamejared.crafttweaker.api.recipes.IRecipeWriter; | ||
import net.minecraft.item.crafting.IRecipe; | ||
import net.minecraftforge.eventbus.api.Event; | ||
|
||
/** | ||
* Alows mods to register {@link IRecipeWriter}s that will be used | ||
* when {@code /ct recipes} or {@code /ct recipes hand} is ran. | ||
*/ | ||
public class RegisterRecipeWritersEvent extends Event { | ||
|
||
/** | ||
* Registers a new {@link IRecipeWriter} for a specific {@link IRecipe} class. | ||
* | ||
* @param recipeClass The Class that this IRecipeWriter should run for | ||
* @param writer IRecipeWriter for the given IRecipe class. | ||
*/ | ||
public void register(Class<? extends IRecipe<?>> recipeClass, IRecipeWriter writer) { | ||
|
||
CraftTweakerAPI.getRecipeWriters().put(recipeClass, writer); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/blamejared/crafttweaker/api/recipes/IRecipeWriter.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,20 @@ | ||
package com.blamejared.crafttweaker.api.recipes; | ||
|
||
import com.blamejared.crafttweaker.api.managers.IRecipeManager; | ||
import net.minecraft.item.crafting.IRecipe; | ||
|
||
|
||
public interface IRecipeWriter { | ||
|
||
/** | ||
* Creates a String representation of a valid {@code addRecipe} (or alternative) call for the given {@link IRecipe} | ||
* | ||
* Recipe Dumps are triggered by the {@code /ct recipes} or {@code /ct recipes hand} commands. | ||
* | ||
* **NOTE** You do not and should not add a newline at the start or end, this is handled for you. | ||
* | ||
* @param builder StringBuilder used for the command output. | ||
* @param recipe IRecipe that is being dumped. | ||
*/ | ||
void write(IRecipeManager manager, StringBuilder builder, IRecipe<?> recipe); | ||
} |
Oops, something went wrong.