mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix interact entity packet (#2179)
For the InteractAt type of packet of the PlayerInteractEntityPacket, Java sends a diff between the entity's current position and the hit result of its cursor. Bedrock sends the full vector location in its interaction. Therefore, we just do the diff ourselves. This fixes taking armor off of armor stands.
This commit is contained in:
parent
abc3a187d4
commit
1301cd9c30
1 changed files with 2 additions and 2 deletions
|
@ -321,7 +321,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
||||||
session.sendUpstreamPacket(openPacket);
|
session.sendUpstreamPacket(openPacket);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Vector3f vector = packet.getClickPosition();
|
Vector3f vector = packet.getClickPosition().sub(entity.getPosition());
|
||||||
ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
|
ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
|
||||||
InteractAction.INTERACT, Hand.MAIN_HAND, session.isSneaking());
|
InteractAction.INTERACT, Hand.MAIN_HAND, session.isSneaking());
|
||||||
ClientPlayerInteractEntityPacket interactAtPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
|
ClientPlayerInteractEntityPacket interactAtPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(),
|
||||||
|
@ -329,7 +329,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
||||||
session.sendDownstreamPacket(interactPacket);
|
session.sendDownstreamPacket(interactPacket);
|
||||||
session.sendDownstreamPacket(interactAtPacket);
|
session.sendDownstreamPacket(interactAtPacket);
|
||||||
|
|
||||||
EntitySoundInteractionHandler.handleEntityInteraction(session, vector, entity);
|
EntitySoundInteractionHandler.handleEntityInteraction(session, packet.getClickPosition(), entity);
|
||||||
break;
|
break;
|
||||||
case 1: //Attack
|
case 1: //Attack
|
||||||
if (entity.getEntityType() == EntityType.ENDER_DRAGON) {
|
if (entity.getEntityType() == EntityType.ENDER_DRAGON) {
|
||||||
|
|
Loading…
Reference in a new issue