Fix block placement handler#839
Conversation
|
Could you double check whether anything changed regarding torches which were standing on the block? |
|
This is only used during block replacement |
|
Yeah, that is what I am talking about |
|
Oh yeah that'll still be broken but that's impossible to fix because we have to give a block update unfortunately |
|
As long as that doesn’t get worse than it is now |
| { | ||
| final Block targetBlock = blockItem.getBlock(); | ||
| fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stackToPlace); | ||
| final BlockPlaceContext ctx = new BlockPlaceContext(new UseOnContext(fakePlayer, InteractionHand.MAIN_HAND, |
There was a problem hiding this comment.
We shouldn't go over this placement context because this will mess with blocks like stairs, etc as they use hit directions etc which will result in strange things.
Which of these things here specifically do the necessary things for the panels to work?
There was a problem hiding this comment.
The problem is I need getStateForPlacement, which is what requires the placement context
There was a problem hiding this comment.
I can do a test with stairs but important is that this is only used by scan tool replaces it looks like
There was a problem hiding this comment.
And the copy properties method that goes after the placement state should copy the direction of a stair over
There was a problem hiding this comment.
getStateForPlacement probably translates some meta data into the blockstate property we need. We should be able to get this from the internal call that method uses
There was a problem hiding this comment.
Just in case, according to documentation (that is, the chat message in game), if you replace a block with another block with similar block states, it should inherit the block states
If the new block has block states that are not present on the old block, the default block state property is used (and the chat message is printed)
Which means, in particular for stairs, if you are replacing one stair with another, it should have the same shape in the same direction, and if you are replacing a non-stair non-shingle with a stair, it should always face in the default direction (north?), independent from how you are standing
There was a problem hiding this comment.
getStateForPlacement probably translates some meta data into the blockstate property we need. We should be able to get this from the internal call that method uses
There's nothing else for this, check PanelBlock in DO
There was a problem hiding this comment.
I verified and stairs continue to work normal. Because of:
BlockState newState = copyFirstCommonBlockStateProperties(placementState != null ? placementState : targetBlock.defaultBlockState(), blockState);
Closes #812
Changes proposed in this pull request
Testing
Review please