3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-05 07:40:11 +01:00

Mark sequence position when block placing

Fixes some instances between 1.19 and 1.20.5 when block ghosting could occur
Dieser Commit ist enthalten in:
Camotoy 2024-07-23 15:43:57 -04:00
Ursprung 1dd9ba3fb6
Commit b113a6b185
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 5 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -201,4 +201,4 @@ public final class WorldCache {
public String removeActiveRecord(Vector3i pos) {
return this.activeRecords.remove(pos);
}
}
}

Datei anzeigen

@ -247,8 +247,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
}
// As of 1.21, Paper does not have any additional range checks that would inconvenience normal players.
// Note that, before these changes, I could replicate on Paper 1.20.4 and iPad 1.21.2 an instance of block ghosting
// that we had not previously implemented. Might be some sort of ray tracing that is currently unimplemented.
Vector3f playerPosition = session.getPlayerEntity().getPosition();
playerPosition = playerPosition.down(EntityDefinitions.PLAYER.offset() - session.getEyeHeight());
@ -284,13 +282,16 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
}
}
// Storing the block position allows inconsistencies in block place checking from post-1.19 - pre-1.20.5 to be resolved.
int sequence = session.getWorldCache().nextPredictionSequence();
session.getWorldCache().markPositionInSequence(blockPos);
ServerboundUseItemOnPacket blockPacket = new ServerboundUseItemOnPacket(
packet.getBlockPosition(),
Direction.VALUES[packet.getBlockFace()],
Hand.MAIN_HAND,
packet.getClickPosition().getX(), packet.getClickPosition().getY(), packet.getClickPosition().getZ(),
false,
session.getWorldCache().nextPredictionSequence());
sequence);
session.sendDownstreamGamePacket(blockPacket);
Item item = session.getPlayerInventory().getItemInHand().asItem();