forked from GeyserMC/Geyser
Update JavaEntityEquipmentTranslator for Java 1.16
This commit is contained in:
parent
bb630dc867
commit
6f2bf659a9
1 changed files with 25 additions and 24 deletions
|
@ -25,14 +25,14 @@
|
||||||
|
|
||||||
package org.geysermc.connector.network.translators.java.entity;
|
package org.geysermc.connector.network.translators.java.entity;
|
||||||
|
|
||||||
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Equipment;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||||
import org.geysermc.connector.entity.Entity;
|
import org.geysermc.connector.entity.Entity;
|
||||||
import org.geysermc.connector.entity.LivingEntity;
|
import org.geysermc.connector.entity.LivingEntity;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||||
import org.geysermc.connector.network.translators.Translator;
|
import org.geysermc.connector.network.translators.Translator;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
|
||||||
import org.geysermc.connector.network.translators.item.ItemTranslator;
|
import org.geysermc.connector.network.translators.item.ItemTranslator;
|
||||||
|
|
||||||
@Translator(packet = ServerEntityEquipmentPacket.class)
|
@Translator(packet = ServerEntityEquipmentPacket.class)
|
||||||
|
@ -55,8 +55,9 @@ public class JavaEntityEquipmentTranslator extends PacketTranslator<ServerEntity
|
||||||
}
|
}
|
||||||
|
|
||||||
LivingEntity livingEntity = (LivingEntity) entity;
|
LivingEntity livingEntity = (LivingEntity) entity;
|
||||||
ItemData item = ItemTranslator.translateToBedrock(session, packet.getItem());
|
for (Equipment equipment : packet.getEquipment()) {
|
||||||
switch (packet.getSlot()) {
|
ItemData item = ItemTranslator.translateToBedrock(session, equipment.getItem());
|
||||||
|
switch (equipment.getSlot()) {
|
||||||
case HELMET:
|
case HELMET:
|
||||||
livingEntity.setHelmet(item);
|
livingEntity.setHelmet(item);
|
||||||
break;
|
break;
|
||||||
|
@ -76,7 +77,7 @@ public class JavaEntityEquipmentTranslator extends PacketTranslator<ServerEntity
|
||||||
livingEntity.setOffHand(item);
|
livingEntity.setOffHand(item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
livingEntity.updateEquipment(session);
|
livingEntity.updateEquipment(session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue