-
Notifications
You must be signed in to change notification settings - Fork 4
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
Unbreaking Enchantment Support #4
Comments
I have forked and successfully used this code to implement the Unbreaking Enchantment. I am not submitting a pull request because when I pushed my changes it removed the iml file for some reason. The plugin works with this feature though, so feel free and use that code if you would like Here is the fork https://github.com/cjstas/JodellePowerMining |
hello there thank you much for helping us <3 |
Thank you very much for reminding of the unbreaking enchantment. I may or may not have forgotten about it 😆 According to the wiki page the durability enchant has a probability of 100/level+1. I tried a very basic implementation of this logic. When I have time I'll take a closer look at it. |
I finished implementing the unbreaking enchantment. |
It would be nice to have support for the unbreaking enchantment. It seems like it would be simple enough to implement when the use tool durability modifier is on, just check if the unbreaking enchantment is there and then apply a durability change according to the level of unbreaking and then make a percentage chance to use durability according to the value. Code could look something like this.
if (useDurabilityPerBlock|| !player.hasPermission("powermining.highdurability")) {
if (curDur++ < maxDur){
int useChance = 0;
if (enchants.get(Enchantment.DURABILITY) !=null) {
useChance += enchants.get(Enchantment.DURABILITY)
}
if (100/(Math.pow(2, useChance))>=(int)Math.floor(Math.random()*(101))) {
handItem.setDurability(curDur);
}
} else {
break;
}
}
Code may not be perfect as it is untested. I plan to fork this repo to try to implement this myself.
The text was updated successfully, but these errors were encountered: