server/block: implement redstone-powered dispensers - #1345
Open
HashimTheArab wants to merge 8 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
item.Dispensableanditem.DispenseContextso vanilla and custom items own specialised dispenser behaviour without a central string registry*world.EntityHandle, with explicit nil support for ownerless dispenser launchesWhy
Dragonfly did not have a registered dispenser implementation, and hoppers did not fully synchronize their locked state with accepted redstone power changes. This adds the missing vanilla container behavior while preserving the project policy of Java-style quasi-connectivity for dispensers. Item-specific actions live on their concrete item types, matching Dragonfly’s capability-interface style and allowing custom items to opt in.
Projectile factories now accept the persistent handle representation stored by their behaviours. This makes ownerless launches explicit at the type boundary and removes the forgettable entity-to-handle conversion helper.
Impact
Servers can place, persist, open, and power dispensers. Dispensers fire once per accepted rising edge after the vanilla four-tick delay, including short pulses, and launch supported projectiles without requiring an owning entity. Unsupported items are ejected normally; specialised items can explicitly report default, success, or failure outcomes. Hoppers now lock and unlock consistently with redstone power.
Ender pearls and attached fireworks reject nil owners; dispenser-compatible projectiles and unattached fireworks may remain ownerless. Bow, crossbow, and thrown-item paths pass the launching entity handle directly.
Validation
go test ./server/blockgo test -race ./server/entity ./server/item ./server/blockgo test ./...go vet ./...gofmton all changed Go filesgit diff --checkcodex review --uncommitted(no actionable findings)