Yarn: Describe current setBlockState bitflags

Created on 18 May 2019  ·  3Comments  ·  Source: FabricMC/yarn

It will be open until comment functionality finally hits, but I also hope to list them in Fabric API, so here goes:

  • 1 corresponds to "send neighbor updates on the server"
  • 2 - if 1, [on the server, mark block as dirty to send it to the client; on the client, schedule a render update]
  • 4 - if 1, skip the client-side render update from above
  • 8 - if 1, force render update to happen on main thread
  • 16 - ???
  • 32 - skip dropping item stacks (used in Block.replaceBlock)
  • 64 - is the block part of a "move" operation (e.g. by a piston?), as per https://github.com/FabricMC/yarn/issues/634

Now, I need better descriptions/names!

I'm also pretty sure updateNeighborStates is wrong and method_11637 and it are both related to said flag 16.

enhancement

Most helpful comment

@asiekierka

0b0000000 // 0 - DEFAULT/NONE
0b0000001 // 1 - PROPAGATE_CHANGE
0b0000010 // 2 - NOTIFY_LISTENERS
0b0000100 // 4 - NO_REDRAW
0b0001000 // 8 - REDRAW_ON_MAIN_THREAD
0b0010000 // 16 - FORCE_STATE*
0b0100000 // 32 - SKIP_DROPS
0b1000000 // 64 - IS_MECHANICAL_UPDATE

  • method_11637 appears to be a method allowing blocks to apply states based on their surroundings, in which case this flag would be used to turn that behaviour off and cause the passed state to be used no matter what.

See: DebugStickItem

iWorld_1.setBlockState(blockPos_1, blockState_2, 18);

0b0010010 // 18 - FORCE_STATE | PROPAGATE_CHANGE

Edit: Renamed some methods based on feedback ( @ChloeDawn )

All 3 comments

Also, World.updateHorizontalAdjacent -> World.updateNeighborComparators, World.updateListeners -> something to do with side-specific block updates idk it's what flag 2 calls

@asiekierka

0b0000000 // 0 - DEFAULT/NONE
0b0000001 // 1 - PROPAGATE_CHANGE
0b0000010 // 2 - NOTIFY_LISTENERS
0b0000100 // 4 - NO_REDRAW
0b0001000 // 8 - REDRAW_ON_MAIN_THREAD
0b0010000 // 16 - FORCE_STATE*
0b0100000 // 32 - SKIP_DROPS
0b1000000 // 64 - IS_MECHANICAL_UPDATE

  • method_11637 appears to be a method allowing blocks to apply states based on their surroundings, in which case this flag would be used to turn that behaviour off and cause the passed state to be used no matter what.

See: DebugStickItem

iWorld_1.setBlockState(blockPos_1, blockState_2, 18);

0b0010010 // 18 - FORCE_STATE | PROPAGATE_CHANGE

Edit: Renamed some methods based on feedback ( @ChloeDawn )

Fixed in #1003 already. Thanks Yanis48 for pointing out!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Boundarybreaker picture Boundarybreaker  ·  3Comments

Awakened-Redstone picture Awakened-Redstone  ·  4Comments

quat1024 picture quat1024  ·  3Comments

Draylar picture Draylar  ·  6Comments

altrisi picture altrisi  ·  4Comments