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 window.hotbarEnd #36

Open
IceTank opened this issue Jun 24, 2021 · 5 comments
Open

Add window.hotbarEnd #36

IceTank opened this issue Jun 24, 2021 · 5 comments

Comments

@IceTank
Copy link
Contributor

IceTank commented Jun 24, 2021

Why?
Because the hotbar ends at slot 44 but the player has 45 inventory slots. If you want to check if an item is in your hotbar you could do window.hotbarStart <= item.slot <= window.hotbarStop. Instead of window.hotbarStart <= item.slot <= 44

@u9g
Copy link
Member

u9g commented Jun 24, 2021

or window.hotbarStart <= item.slot <= window.hotbarStart + 9

@u9g
Copy link
Member

u9g commented Jun 24, 2021

the 45th is offhand, idk, is that considered hotbar?

@IceTank
Copy link
Contributor Author

IceTank commented Jun 24, 2021

If you want to activate an item or place a block you have to give extra arguments to place with the off-hand

@Gjum
Copy link
Member

Gjum commented Jun 24, 2021

window.hotbarStart <= item.slot < window.hotbarStart + 9
notice the second one has to be exclusive <

@u9g
Copy link
Member

u9g commented Jun 25, 2021

window.hotbarStart <= item.slot < window.hotbarStart + 9
notice the second one has to be exclusive <

this won’t work in js regardless, to add to this for anyone looking at this issue later, you have to seperate comprasions with || or &&, window.hotbarStart <= item.slot && item.slot < window.hotbarStart + 9

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

No branches or pull requests

3 participants