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

Fix hopper updates source slot twice #11945

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nostalfinals
Copy link
Contributor

@nostalfinals nostalfinals commented Jan 10, 2025

Fix #11740

The hopperPush/hopperPull methods introduced by the Optimize Hoppers patch already update the source slot correctly after moving items:

  • hopperPush:
    image

  • hopperPull:
    image

However, in HopperBlockEntity#tryMoveInItem, if the target slot isn't empty (i.e., a merge happens), the source slot is updated once again by shrinking the source ItemStack. This causes issues with certain source containers, such as the chiseled bookshelf.

image

Since the ChiseledBookShelfBlockEntity checks whether the removeItem call is meaningful (i.e., ensuring it doesn't attempt to remove an already empty slot), and tryMoveInItem is called before removeItem, the block state of the current chiseled bookshelf isn't updated properly. As a result, the book still visually remains in the bookshelf:

image

The return value of tryMoveInItem is essential (it’s used by hopperPush/hopperPull), so I've added a copy before operating the source ItemStack to resolve this issue.


Download the paperclip jar for this pull request: paper-11945.zip

@nostalfinals nostalfinals requested a review from a team as a code owner January 10, 2025 16:49
@kennytv kennytv added type: bug Something doesn't work as it was intended to. build-pr-jar Enables a workflow to build Paperclip jars on the pull request. labels Jan 10, 2025
MrHua269 added a commit to LuminolMC/Luminol that referenced this pull request Jan 11, 2025
MrHua269 added a commit to LuminolMC/Luminol that referenced this pull request Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-pr-jar Enables a workflow to build Paperclip jars on the pull request. type: bug Something doesn't work as it was intended to.
Projects
Status: Awaiting review
Development

Successfully merging this pull request may close these issues.

chiseled bookshelf does not get updated after hopper pulls book
2 participants