SOLVED: I ended up inheriting from WallMountedBlock and it takes care of it. No idea how it took care of it though, it is not clear, but I suspect it is doing it in getStateForNeighborUpdate() by returning Blocks.AIR.getDefaultState().
I have an item attached to a block. I use the Block.neighborUpdate() to do things when the attachment block's state changes.
Since I have to break my block when the attachment block breaks, I need to distinguish the "block is in the process of breaking" from the other state changes, but I can't find a way to measure it.
Things I already tried:
- I verified that block and fromPos reflect the attachment block - before the break. (nope, not getting Air back)
- I checked world.getBlockState(fromPos).getBlock() and it returns the block before the break, not Air.
- I tried to find anything in the BlockState of fromPos that would indicate that the block is in the process of breaking. No joy. I also checked for any indication of the damage level, but the best I found was the amount of damage that the player was currently making, and that is probably only valid for the client thread.
SOLVED: I ended up inheriting from WallMountedBlock and it takes care of it. No idea how it took care of it though, it is not clear, but I suspect it is doing it in getStateForNeighborUpdate() by returning Blocks.AIR.getDefaultState().
I have an item attached to a block. I use the Block.neighborUpdate() to do things when the attachment block's state changes.
Since I have to break my block when the attachment block breaks, I need to distinguish the "block is in the process of breaking" from the other state changes, but I can't find a way to measure it.
Things I already tried:
- I verified that block and fromPos reflect the attachment block - before the break. (nope, not getting Air back)
- I checked world.getBlockState(fromPos).getBlock() and it returns the block before the break, not Air.
- I tried to find anything in the BlockState of fromPos that would indicate that the block is in the process of breaking. No joy. I also checked for any indication of the damage level, but the best I found was the amount of damage that the player was currently making, and that is probably only valid for the client thread.
Any suggestions?