mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix issue where doors would update twice when opening/closing them using the upper half
This commit is contained in:
parent
d6a8e6231e
commit
34d7069c09
1 changed files with 14 additions and 1 deletions
|
|
@ -37,9 +37,22 @@ public class DoorBlock extends Block {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateBlock(GeyserSession session, BlockState state, Vector3i position) {
|
public void updateBlock(GeyserSession session, BlockState state, Vector3i position) {
|
||||||
|
// Needed to check whether we must force the client to update the door state.
|
||||||
|
String double_block_half_state = state.getValue(Properties.DOUBLE_BLOCK_HALF);
|
||||||
|
|
||||||
|
if (double_block_half_state.equals("lower")) {
|
||||||
|
BlockState oldBlockState = session.getGeyser().getWorldManager().blockAt(session, position);
|
||||||
|
// If these are the same, it means that we already updated the lower door block (manually in the workaround below),
|
||||||
|
// and we do not need to update the block in the cache/on the client side using the super.updateBlock() method again.
|
||||||
|
// Otherwise, we send the door updates twice which will cause visual glitches on the client side
|
||||||
|
if (oldBlockState == state) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
super.updateBlock(session, state, position);
|
super.updateBlock(session, state, position);
|
||||||
|
|
||||||
if (state.getValue(Properties.DOUBLE_BLOCK_HALF).equals("upper")) {
|
if (double_block_half_state.equals("upper")) {
|
||||||
// Update the lower door block as Bedrock client doesn't like door to be closed from the top
|
// Update the lower door block as Bedrock client doesn't like door to be closed from the top
|
||||||
// See https://github.com/GeyserMC/Geyser/issues/4358
|
// See https://github.com/GeyserMC/Geyser/issues/4358
|
||||||
Vector3i belowDoorPosition = position.sub(0, 1, 0);
|
Vector3i belowDoorPosition = position.sub(0, 1, 0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue