feat: allow scripts to modify anvil cost

This commit is contained in:
Kam committed 2025-07-09 22:43:06 -04:00
1 parent 2cd06193c2
commit e73e785fbf
2 files changed
+35 -6

No files matched your search

@@ -36,6 +36,8 @@ public class RecipeScriptEvent extends PlayerEvent {
@Cancelable
public static class Pre extends RecipeScriptEvent {
private String message = "";
private int xpCost = 0;
private int materialUsage = 0;
public Pre(IPlayer player, Object recipe, boolean isAnvil, IItemStack[] items) {
super(player, recipe, isAnvil, items);
@@ -49,6 +51,24 @@ public class RecipeScriptEvent extends PlayerEvent {
return message;
}
public int getXpCost() {
return xpCost;
}
public void setXpCost(int xpCost) {
if (this.isAnvil)
this.xpCost = xpCost;
}
public int getMaterialUsage() {
return materialUsage;
}
public void setMaterialUsage(int materialUsage) {
if (this.isAnvil)
this.materialUsage = materialUsage;
}
public String getHookName() {
return RecipeScript.ScriptType.PRE.function;
}