EngineHub / CommandHelper

Rapid scripting and command aliases for Minecraft owners
https://methodscript.com
Other
119 stars 71 forks source link

add modify for item_pre_anvil's item_repair_cost/level_repair_cost #1385

Closed Lildirt closed 4 months ago

Lildirt commented 4 months ago

While writing some code around item_pre_anvil, I noticed you can't actually click the result slot if the result tool has no enchantments on it. It becomes a nothing click if the level cost isn't set.

PseudoKnight commented 4 months ago

Oh good. This is useful for other cases too. Add these to the mutable fields in documentation.

PseudoKnight commented 4 months ago

Does setMaximumRepairCost() work here too? If so, that would be worth adding as well if people want to uncap repair costs.

PseudoKnight commented 4 months ago

Just noticed repair get|setRepairCostAmount() was added in 1.18.1. We'll need to fix this for earlier versions. If you want to do it, you just have to check Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_18_1) before using those methods in evaluate() and modifyEvent(). Then I usually add (MC 1.18.1+) to the data field in the docs.

Lildirt commented 4 months ago

Does setMaximumRepairCost() work here too? If so, that would be worth adding as well if people want to uncap repair costs.

Sort of. It does work, and the max cost is respected on the server side. I can smith a tool with a level cost of 50 and a max cost of 55, but the client side will always show "Too Expensive!" for anything that breaks the Vanilla limit.

I can still include it. I don't think there's any way to fix the "Too Expensive!" bit on the client-side though.

Screenshot

Lildirt commented 4 months ago

Pushed the suggested changes. Included a disclaimer on the docs related to my last comment.

PseudoKnight commented 4 months ago

That's a shame. So not only is the cost higher, but it's a mystery! One could change that text with a resource pack, probably, but it would be impossible to show the actual cost in the GUI. Would have to print it to chat or something. Still, probably worth including.

Anyway, looks good!

PseudoKnight commented 4 months ago

I guess the one thing a user could do is cap the repair cost to the lowest visible value. Not sure if that's 39 or 40. But if they want to make a player pay for the extra repair, they'll have to settle for some other visual indicator or the mystery.