Anvil Recipes

This commit is contained in:
Kam committed 2025-02-10 02:44:13 -05:00
1 parent 17d165e628
commit f91f9b43ba
2 files changed
+62 -18

No files matched your search

@@ -1,18 +1,25 @@
package noppes.npcs.api.handler;
import net.minecraft.item.ItemStack;
import noppes.npcs.api.handler.data.IRecipe;
import java.util.List;
public interface IRecipeHandler {
List<IRecipe> getGlobalList();
List<IRecipe> getCarpentryList();
void addRecipe(String var1, boolean var2, ItemStack var3, Object... var4);
void addRecipe(String var1, boolean var2, ItemStack var3, int var4, int var5, ItemStack... var6);
IRecipe delete(int var1);
}
package noppes.npcs.api.handler;
import net.minecraft.item.ItemStack;
import noppes.npcs.api.handler.data.IAnvilRecipe;
import noppes.npcs.api.handler.data.IRecipe;
import java.util.List;
public interface IRecipeHandler {
List<IRecipe> getGlobalList();
List<IRecipe> getCarpentryList();
List<IAnvilRecipe> getAnvilList();
void addRecipe(String var1, boolean var2, ItemStack var3, Object... var4);
void addRecipe(String var1, boolean var2, ItemStack var3, int var4, int var5, ItemStack... var6);
IRecipe delete(int var1);
IAnvilRecipe deleteAnvil(int var1);
void addAnvilRecipe(String name, boolean global, ItemStack itemToRepair, ItemStack repairMaterial, int xpCost, float repairPercentage);
}
@@ -0,0 +1,37 @@
package noppes.npcs.api.handler.data;
import net.minecraft.item.ItemStack;
public interface IAnvilRecipe {
/**
* Returns the unique name of this anvil recipe.
*/
String getName();
/**
* The XP cost per repair tick (e.g., 10 levels per tick).
*/
int getXpCost();
/**
* The repair percentage (e.g., 0.1f repairs 10% of max damage per tick).
*/
float getRepairPercentage();
/**
* Checks whether the provided item and repair material match this recipe.
* @param itemToRepair the damaged item
* @param repairMaterial the material used to repair
* @return true if the items match the recipe requirements
*/
boolean matches(ItemStack itemToRepair, ItemStack repairMaterial);
/**
* Returns the repaired item based on the input damaged item.
* @param itemToRepair the input damaged item
* @return a copy with reduced damage
*/
ItemStack getResult(ItemStack itemToRepair);
int getID();
}