Create First Push of Recipe Events

This commit is contained in:
Kam committed 2025-07-09 15:40:31 -04:00
1 parent 2860cc5cf3
commit bacfb5eba0
15 files changed
+671 -57

No files matched your search

@@ -0,0 +1,66 @@
package noppes.npcs.scripted.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import noppes.npcs.api.handler.data.IRecipe;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.item.IItemStack;
import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.controllers.data.RecipeScript;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.event.player.PlayerEvent;
public class RecipeScriptEvent extends PlayerEvent {
public final Object recipe;
public final IItemStack[] items;
public final boolean isAnvil;
public RecipeScriptEvent(IPlayer player, Object recipe, boolean anvil, IItemStack[] items) {
super(player);
this.recipe = recipe;
this.items = items;
this.isAnvil = anvil;
}
public Object getRecipe() {
return recipe;
}
public IItemStack[] getItems() {
return items;
}
public boolean isAnvil() {
return isAnvil;
}
@Cancelable
public static class Pre extends RecipeScriptEvent {
public Pre(IPlayer player, Object recipe, boolean isAnvil, IItemStack[] items) {
super(player, recipe, isAnvil, items);
}
public String getHookName() {
return RecipeScript.ScriptType.PRE.function;
}
}
public static class Post extends RecipeScriptEvent {
private IItemStack result;
public Post(IPlayer player, Object recipe, boolean isAnvil, IItemStack[] items, IItemStack result) {
super(player, recipe, isAnvil, items);
this.result = result;
}
public IItemStack getCraft() {
return result;
}
public void setResult(IItemStack stack) {
this.result = stack;
}
public String getHookName() {
return RecipeScript.ScriptType.POST.function;
}
}
}