Skip to content

Fix all your getStackInSlotOnClosing #1414

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

Closed
SoniEx2 opened this issue Sep 9, 2015 · 6 comments
Closed

Fix all your getStackInSlotOnClosing #1414

SoniEx2 opened this issue Sep 9, 2015 · 6 comments
Milestone

Comments

@SoniEx2
Copy link
Contributor

SoniEx2 commented Sep 9, 2015

@LizzyTrickster
Copy link
Contributor

Instead of making demands why don't you explain whatever the problem is and why it should be "fixed"?

@SoniEx2
Copy link
Contributor Author

SoniEx2 commented Sep 9, 2015

It should remove stacks from slots. If you look at all the implementations they're mostly copypasted, except for the player inventory. That one handles both normal inventory and armor inventory, which takes a bit more effort than copypasting. Thus, it is safe to assume that method is meant for removing stacks from slots.

Sure, it's only ever called by vanilla when removing stacks on container close, but that doesn't make it any less of a removeStackFromSlot.

Sorry, something went wrong.

@fnuecke
Copy link
Member

fnuecke commented Sep 9, 2015

From my understanding this is for stuff like the crafting table, i.e. 'temporary' inventories. AKA nothing in OC. If you can point me to a single use-case (in vanilla) that says otherwise, please do.

Sorry, something went wrong.

@SoniEx2
Copy link
Contributor Author

SoniEx2 commented Sep 9, 2015

It's only /used/ that way, but it's ALWAYS implemented in the exact same way: If the slot is empty return null, otherwise return whatever is in there, while setting it to null.

Also, it wouldn't do any harm to implement it that way.

The fact that both player inventories and beacons have specialized implementations (instead of copypaste and/or being left unimplemented) and the fact that all implementations remove stack from slot makes me believe it's supposed to be named removeStackFromSlot instead of getStackInSlotOnClosing.

Sorry, something went wrong.

@fnuecke
Copy link
Member

fnuecke commented Sep 9, 2015

Hmm, interesting, that indeed sounds likely. It'd also explain why it never caused any issues in over two years; nobody's actually calling that because of the weird name :P Since it at least isn't called from anywhere within OC, I suppose I might as well change it.

@fnuecke
Copy link
Member

fnuecke commented Sep 11, 2015

af49402

@fnuecke fnuecke closed this as completed Sep 11, 2015
@fnuecke fnuecke added this to the v1.5.18 milestone Sep 11, 2015
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