Skip to content

Fix item duplication using same block removal strategy as Create contraptions#659

Open
SAILQAQ wants to merge 2 commits intoryanhcode:mainfrom
SAILQAQ:main
Open

Fix item duplication using same block removal strategy as Create contraptions#659
SAILQAQ wants to merge 2 commits intoryanhcode:mainfrom
SAILQAQ:main

Conversation

@SAILQAQ
Copy link
Copy Markdown

@SAILQAQ SAILQAQ commented Apr 30, 2026

After saving BE NBT, call level.removeBlockEntity() to detach the block entity from the world before it can drop items. Then destroy old blocks via level.setBlock() with UPDATE_MOVE_BY_PISTON | UPDATE_SUPPRESS_DROPS | UPDATE_CLIENTS — the same approach Create uses in its contraption system.

This replaces the Clearable/RandomizableContainer approach which only covered mods that explicitly implement those interfaces.

SAILQAQ added 2 commits April 29, 2026 23:49
Two fixes combined:
1. From pr-365: Replace old blocks with barriers before removal. This prevents brittle blocks (torches, buttons, etc.) from breaking when their supportblock is removed, which could also cause duplication.

2. New fix: After saving BE NBT, call level.removeBlockEntity() to detach the block entity from the world before it can drop items. Then destroy barriers via level.setBlock() with UPDATE_MOVE_BY_PISTON | UPDATE_SUPPRESS_DROPS | UPDATE_CLIENTS — the same approach Create uses in its contraption system.
Removed temporary barrier replacement logic .
@SAILQAQ SAILQAQ changed the title Improve assembly block handling to prevent item duplication Remove barrier step Apr 30, 2026
@SAILQAQ SAILQAQ changed the title Remove barrier step Improve assembly block handling to prevent item duplication Apr 30, 2026
@SAILQAQ SAILQAQ changed the title Improve assembly block handling to prevent item duplication Fix item duplication using same block removal strategy as Create contraptions Apr 30, 2026
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

Successfully merging this pull request may close these issues.

1 participant