3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Update JavaEntityEquipmentTranslator for Java 1.16

Dieser Commit ist enthalten in:
DoctorMacc 2020-06-25 21:53:51 -04:00
Ursprung bb630dc867
Commit 6f2bf659a9

Datei anzeigen

@ -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,28 +55,29 @@ 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());
case HELMET: switch (equipment.getSlot()) {
livingEntity.setHelmet(item); case HELMET:
break; livingEntity.setHelmet(item);
case CHESTPLATE: break;
livingEntity.setChestplate(item); case CHESTPLATE:
break; livingEntity.setChestplate(item);
case LEGGINGS: break;
livingEntity.setLeggings(item); case LEGGINGS:
break; livingEntity.setLeggings(item);
case BOOTS: break;
livingEntity.setBoots(item); case BOOTS:
break; livingEntity.setBoots(item);
case MAIN_HAND: break;
livingEntity.setHand(item); case MAIN_HAND:
break; livingEntity.setHand(item);
case OFF_HAND: break;
livingEntity.setOffHand(item); case OFF_HAND:
break; livingEntity.setOffHand(item);
break;
}
} }
livingEntity.updateEquipment(session); livingEntity.updateEquipment(session);
} }
} }