-
-
Notifications
You must be signed in to change notification settings - Fork 953
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
Fixed the enchantment table "ready" event, which has been broken for years. #3120
Conversation
made expected enchant be a string and not an id
Please seperate this pr into two seperate prs, since it has two distinctly different changes. |
One thing I am worried about is that the packets for [
{ level: 5, expected: { enchant: 'unbreaking', level: -1 } },
{ level: 11, expected: { enchant: null, level: -1 } },
{ level: 30, expected: { enchant: null, level: -1 } }
] Does anyone know the order with which the packets get sent? Maybe it would be smarter to make the "ready" event reliant on |
i dont know how to do that 😭 I made a commit to my fork and it got auto-added to the pull request I think it's okay if we keep this as a 2 in 1, just a general enchanting library fix and overhaul to modernise it. |
That's exactly the problem, the "overhaul" is a breaking change to anyone who uses this now. |
JavaScript is a language that requires one to actively update their code to the newest documentation, atleast as far as web development goes. I don't think this would go against that principle. Also I would like to mention that there is not a single person that used the enchanting library, since it was broken this whole time. Think of this as a new feature getting added, instead of an old one being modified. Enchanting did not really exist in a usable form up to this point. And the few people that did use it are certainly smart and involved enough to know where the issue lies |
1.8.8 enchanting test is failing |
can you please merge this and ignore 1.8.8, the enchanting module does not work on ANY major version right now. While we are worrying that 1.8.8 might be broken, every major release in the last few years is broken, and this is a fix for them. I cant manually do this tweak in each of my projects, pls just merge it |
We can't merge PR which break the CI or it breaks merging any further PR If you care about this change then take a few minutes to finish it |
@rom1504 should be complete? the failed CI check is for the windowOpen event, it has nothing to do with my PR |
@@ -75,6 +108,10 @@ function inject (bot) { | |||
if (!ready) await once(enchantmentTable, 'ready') | |||
choice = parseInt(choice, 10) // allow string argument | |||
assert.notStrictEqual(enchantmentTable.enchantments[choice].level, -1) | |||
|
|||
// if (enchantmentTable.enchantments[choice].level>bot.experience.level) throw new Error('insufficient xp to enchant') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented code
if (slots[0].level >= 0 && slots[1].level >= 0 && slots[2].level >= 0) { | ||
let readycheck; | ||
|
||
if (bot.majorVersion === "1.8") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use support feature
} | ||
}} | ||
|
||
// console.log(packet.property) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented code
Tests fail and the code is clearly not ready Re open if you want to implement this |
What used to happen was that the "ready" event would get emitted when all the level values were above 0, however 0 means that a packet hasnt been sent yet