Yarn: Block Action -> ?

Created on 1 May 2020  路  6Comments  路  Source: FabricMC/yarn

What yarn currently calls "block actions" are used by:

  • Pistons (for pushing)
  • Note blocks (for playing a sound)
  • Bells (for ringing)
  • Chests (for the opening animation)
  • Ender chests (for the opening animation)
  • Shulker boxes (for the opening animation)
  • End gateways (for the beam)
  • Mob spawners (triggered when the mob spawns to reset the mob spinning speed)

"Block actions" are triggered by the server, and processed by both the server and clients within range of the block (the "block action" is sent to these clients). Basically, it is used for events that also need to be processed on the client.

The yarn name is confusing and does not capture its actual purpose. It looks like a method you would want to call to simulate a right-click action or something. What should we call it instead?

discussion refactor

Most helpful comment

The problem with BlockEvent is that, although it's more commonly used throughout communities and is consistent with world event, the name has the exact same issues as "block action".

I therefore propose World.addBlockAction to be renamed to addSyncedBlockEvent and Block.onBlockAction to onSyncedBlockEvent. The class currently called BlockAction can be renamed to BlockEvent - it doesn't need to be SyncedBlockEvent because nothing about the class implies that it's synced.
Similarly, I propose world events to be renamed to synced world events to be clearer and more consistent with this.

All 6 comments

Maybe go for simplicity... Sync Event?

There are also world events for worlds, which are basically the same thing but not dependent on a Block instance, so "[something] event" would be good.

"Sync event" is a bit ugly IMO but descriptive, so it could work.

BlockEvent?

I personally think action describes perfectly all of these. The word action just means "something that is done" (pushing, playing, ringing, opening, emitting a beam, etc.)

But this is more specific than simply something that is done, it's something that need to be done on the client. Look over this list again, and see if you can spot that pattern.

The problem with BlockEvent is that, although it's more commonly used throughout communities and is consistent with world event, the name has the exact same issues as "block action".

I therefore propose World.addBlockAction to be renamed to addSyncedBlockEvent and Block.onBlockAction to onSyncedBlockEvent. The class currently called BlockAction can be renamed to BlockEvent - it doesn't need to be SyncedBlockEvent because nothing about the class implies that it's synced.
Similarly, I propose world events to be renamed to synced world events to be clearer and more consistent with this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quat1024 picture quat1024  路  3Comments

asiekierka picture asiekierka  路  4Comments

Bixilon picture Bixilon  路  5Comments

Boundarybreaker picture Boundarybreaker  路  3Comments

Awakened-Redstone picture Awakened-Redstone  路  4Comments