forked from GeyserMC/Geyser
fix interact at
This commit is contained in:
parent
672024c718
commit
e3932cba62
1 changed files with 17 additions and 5 deletions
|
@ -85,11 +85,23 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//https://wiki.vg/Protocol#Interact_Entity
|
||||||
|
switch (packet.getActionType()) {
|
||||||
|
case 0: //Interact
|
||||||
Vector3f vector = packet.getClickPosition();
|
Vector3f vector = packet.getClickPosition();
|
||||||
ClientPlayerInteractEntityPacket entityPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
|
ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
|
||||||
InteractAction.values()[packet.getActionType()], vector.getX(), vector.getY(), vector.getZ(), Hand.MAIN_HAND);
|
InteractAction.INTERACT, Hand.MAIN_HAND);
|
||||||
|
ClientPlayerInteractEntityPacket interactAtPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
|
||||||
session.getDownstream().getSession().send(entityPacket);
|
InteractAction.INTERACT_AT, vector.getX(), vector.getY(), vector.getZ(), Hand.MAIN_HAND);
|
||||||
|
session.getDownstream().getSession().send(interactPacket);
|
||||||
|
session.getDownstream().getSession().send(interactAtPacket);
|
||||||
|
break;
|
||||||
|
case 1: //Attack
|
||||||
|
ClientPlayerInteractEntityPacket attackPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
|
||||||
|
InteractAction.ATTACK);
|
||||||
|
session.getDownstream().getSession().send(attackPacket);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue