Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add modify for item_pre_anvil's item_repair_cost/level_repair_cost #1385

Merged
merged 2 commits into from
Jul 6, 2024

Conversation

Lildirt
Copy link
Contributor

@Lildirt Lildirt commented Jul 4, 2024

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
Copy link
Contributor

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

@PseudoKnight
Copy link
Contributor

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

@PseudoKnight
Copy link
Contributor

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
Copy link
Contributor Author

Lildirt commented Jul 5, 2024

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
Copy link
Contributor Author

Lildirt commented Jul 5, 2024

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

@PseudoKnight
Copy link
Contributor

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 PseudoKnight merged commit f95e5af into EngineHub:master Jul 6, 2024
2 of 4 checks passed
@PseudoKnight
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants