Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-25 15:50:14 +01:00
Add support for offhand
Dieser Commit ist enthalten in:
Ursprung
b18b83fd9a
Commit
fa7324e1f5
@ -27,6 +27,7 @@ package org.geysermc.connector.entity;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.ContainerId;
|
||||
import com.nukkitx.protocol.bedrock.data.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.data.ItemData;
|
||||
import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket;
|
||||
@ -47,6 +48,7 @@ public class LivingEntity extends Entity {
|
||||
protected ItemData leggings = ItemData.AIR;
|
||||
protected ItemData boots = ItemData.AIR;
|
||||
protected ItemData hand = ItemData.AIR;
|
||||
protected ItemData offHand = ItemData.AIR;
|
||||
|
||||
public LivingEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) {
|
||||
super(entityId, geyserId, entityType, position, motion, rotation);
|
||||
@ -80,12 +82,22 @@ public class LivingEntity extends Entity {
|
||||
armorEquipmentPacket.setLeggings(leggings);
|
||||
armorEquipmentPacket.setBoots(boots);
|
||||
|
||||
MobEquipmentPacket mobEquipmentPacket = new MobEquipmentPacket();
|
||||
mobEquipmentPacket.setRuntimeEntityId(geyserId);
|
||||
mobEquipmentPacket.setItem(hand);
|
||||
mobEquipmentPacket.setHotbarSlot(-1);
|
||||
MobEquipmentPacket handPacket = new MobEquipmentPacket();
|
||||
handPacket.setRuntimeEntityId(geyserId);
|
||||
handPacket.setItem(hand);
|
||||
handPacket.setHotbarSlot(-1);
|
||||
handPacket.setInventorySlot(0);
|
||||
handPacket.setContainerId(ContainerId.INVENTORY);
|
||||
|
||||
MobEquipmentPacket offHandPacket = new MobEquipmentPacket();
|
||||
offHandPacket.setRuntimeEntityId(geyserId);
|
||||
offHandPacket.setItem(offHand);
|
||||
offHandPacket.setHotbarSlot(-1);
|
||||
offHandPacket.setInventorySlot(0);
|
||||
offHandPacket.setContainerId(ContainerId.OFFHAND);
|
||||
|
||||
session.getUpstream().sendPacket(armorEquipmentPacket);
|
||||
session.getUpstream().sendPacket(mobEquipmentPacket);
|
||||
session.getUpstream().sendPacket(handPacket);
|
||||
session.getUpstream().sendPacket(offHandPacket);
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class JavaEntityEquipmentTranslator extends PacketTranslator<ServerEntity
|
||||
livingEntity.setHand(item);
|
||||
break;
|
||||
case OFF_HAND:
|
||||
// TODO: livingEntity.setOffHand(item);
|
||||
livingEntity.setOffHand(item);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren