Skip to content

Conversation

quattage
Copy link

@quattage quattage commented Oct 12, 2025

This PR contains small addition to the Contraption and associated MovementBehaviour API that allows implementations to have simultaneous access to both the BlockEntity and the AbstractContraptionEntity in specific contexts where such a thing could be useful.

  • Added ContraptionHandoffContainer and ContraptionHandoffContext record to store references to the state, position, and BlockEntity

  • Added ListeningMovementBehaviour subinterface that has two extra methods: onAddedToContraption and onRemovedFromContraption

  • Added a list to Contraption that stores ContraptionHandoffContainer instances and immediately disposes of them once the list is used. This list is always null except for the brief period where the contraption is transitioning between states.

  • Added ContraptionEvent and its accompanying concrete Assemble and Disassemble events, which are invoked by the Contraption and AbstractContraptionEntity respectively.

This API addition is functionally identical to a mixin I wrote that can be found here

And here's a quick example of what I'm currently using the mixin to do:

sauce2.mp4

- New NeoForge events associated with contraption assembly/disassembly
- New MovementBehaviour subinterface adds onAddedTo/onRemovedFrom for tacking additional behaviour-specific logic onto the contraption assembly/disassembly process
@quattage quattage changed the title Actor Extensions Additional MovementBehaviour API options Oct 12, 2025
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