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

AdaptorPlayerInventory.isItemValidForSlot is always true? #572

Closed
fnuecke opened this issue Dec 10, 2014 · 3 comments
Closed

AdaptorPlayerInventory.isItemValidForSlot is always true? #572

fnuecke opened this issue Dec 10, 2014 · 3 comments
Labels

Comments

@fnuecke
Copy link
Contributor

@fnuecke fnuecke commented Dec 10, 2014

I ran into an odd issue earlier, which finally boiled down to AdaptorPlayerInventory.isItemValidForSlot always returning true. Is there a reason for this, and not calling src.isItemValidForSlot instead?

I'm aware that this isn't usually an issue, because normally all slots of a player's inventory (except armor slots, which aren't part of the mainInventory) accept all items. However, certain fake players (in my case, OC robots) may have slots in their inventory that don't. I've worked around this by adding a validity check in my setInventorySlotContents method for now, dropping the stack into the world in case of an invalid insertion, but it'd be nice if this could be avoided.

The specific use-case where this was the problem? Robots activating conversion monitors to extract items. Which is really borderline, I know. So I'd understand if you'd just close this. But I'd just like to know if there's a reason for this (performance?), or if it might have been an oversight?

@yueh
Copy link
Member

@yueh yueh commented Dec 10, 2014

It might be a way to make it harder for fake players to use it.

Or just an oversight based on the assumption that only real player would use it.
If it is an oversight, than getSizeInventory is probably one and also affecting the WrapperChainedInventory.

Probably a question for @AlgorithmX2

@AlgorithmX2
Copy link
Contributor

@AlgorithmX2 AlgorithmX2 commented Dec 10, 2014

All I can say is that I remember Player not really providing a usable isItemvalidForSlot implementation ( this might be false ) - Other then that I doubt there's a reason, if using that that method fixes it sounds reasonable to me.

Most of the inventory adapators are ports from AE1 to an extent, since I didn't feel like re-testing them and most of them works reasonably well, so they are ancient.

@thatsIch thatsIch closed this in 72b3be0 Dec 22, 2014
thatsIch pushed a commit that referenced this issue Dec 22, 2014
Fixes #572 Enable inventory validation for any kind of Player
@fnuecke
Copy link
Contributor Author

@fnuecke fnuecke commented Dec 22, 2014

Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.