Skip to content

Commit

Permalink
item_pre_anvil more feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Lildirt committed Jul 5, 2024
1 parent 7c967e2 commit fc33063
Showing 1 changed file with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,12 @@ public String docs() {
+ " | result: the result of the recipe."
+ " | max_repair_cost: the maximum possible cost of this repair."
+ " | level_repair_cost: how many levels are needed to perform this repair."
+ " | item_repair_cost: how many items are needed to perform this repair. }"
+ " { result: the result of the anvil }"
+ " | item_repair_cost: how many items are needed to perform this repair (MC 1.18.1+). }"
+ " { result: the result of the recipe."
+ " | level_repair_cost: how many levels are needed to perform this repair."
+ " | item_repair_cost: how many items are needed to perform this repair (MC 1.18.1+)."
+ " | max_repair_cost: the maximum possible cost of this repair. Values exceeding 40 will be"
+ " respected, but may still show as too expensive on the client. }"
+ " {}";
}

Expand All @@ -1036,9 +1040,11 @@ public Map<String, Mixed> evaluate(BindableEvent event) throws EventException {
ret.put("first_item", ObjectGenerator.GetGenerator().item(anvil.getFirstItem(), Target.UNKNOWN));
ret.put("second_item", ObjectGenerator.GetGenerator().item(anvil.getSecondItem(), Target.UNKNOWN));
ret.put("result", ObjectGenerator.GetGenerator().item(anvil.getResult(), Target.UNKNOWN));
ret.put("max_repair_cost", new CInt(anvil.getMaximumRepairCost(), Target.UNKNOWN));
ret.put("level_repair_cost", new CInt(anvil.getRepairCost(), Target.UNKNOWN));
ret.put("item_repair_cost", new CInt(anvil.getRepairCostAmount(), Target.UNKNOWN));
if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_18_1)) {
ret.put("item_repair_cost", new CInt(anvil.getRepairCostAmount(), Target.UNKNOWN));
}
ret.put("max_repair_cost", new CInt(anvil.getMaximumRepairCost(), Target.UNKNOWN));

return ret;
} else {
Expand Down Expand Up @@ -1067,7 +1073,16 @@ public boolean modifyEvent(String key, Mixed value, BindableEvent event) {
}

if(key.equalsIgnoreCase("item_repair_cost")) {
anvil.setRepairCostAmount(ArgumentValidation.getInt32(value, t));
if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_18_1)) {
anvil.setRepairCostAmount(ArgumentValidation.getInt32(value, t));
return true;
} else {
return false;
}
}

if(key.equalsIgnoreCase("max_repair_cost")) {
anvil.setMaximumRepairCost(ArgumentValidation.getInt32(value, t));
return true;
}
}
Expand Down

0 comments on commit fc33063

Please sign in to comment.