mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Remove Y pos workaround in BedrockItemFrameDropItemTranslator (#1037)
This commit is contained in:
parent
07f3d45cc4
commit
86f18c9392
1 changed files with 1 additions and 9 deletions
|
@ -40,15 +40,7 @@ public class BedrockItemFrameDropItemTranslator extends PacketTranslator<ItemFra
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ItemFrameDropItemPacket packet, GeyserSession session) {
|
public void translate(ItemFrameDropItemPacket packet, GeyserSession session) {
|
||||||
// I hope that, when we die, God (or whoever is waiting for us) tells us exactly why this code exists
|
Vector3i position = Vector3i.from(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ());
|
||||||
// The packet sends the Y coordinate (and just the Y coordinate) divided by two, and it's negative if it needs to be subtracted by one
|
|
||||||
int y;
|
|
||||||
if (packet.getBlockPosition().getY() > 0) {
|
|
||||||
y = packet.getBlockPosition().getY() * 2;
|
|
||||||
} else {
|
|
||||||
y = (packet.getBlockPosition().getY() * -2) - 1;
|
|
||||||
}
|
|
||||||
Vector3i position = Vector3i.from(packet.getBlockPosition().getX(), y, packet.getBlockPosition().getZ());
|
|
||||||
ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) ItemFrameEntity.getItemFrameEntityId(session, position),
|
ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) ItemFrameEntity.getItemFrameEntityId(session, position),
|
||||||
InteractAction.ATTACK, Hand.MAIN_HAND, session.isSneaking());
|
InteractAction.ATTACK, Hand.MAIN_HAND, session.isSneaking());
|
||||||
session.sendDownstreamPacket(interactPacket);
|
session.sendDownstreamPacket(interactPacket);
|
||||||
|
|
Loading…
Reference in a new issue