Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-04 23:30:17 +01:00
Update JavaEntityEquipmentTranslator for Java 1.16
Dieser Commit ist enthalten in:
Ursprung
bb630dc867
Commit
6f2bf659a9
@ -25,14 +25,14 @@
|
||||
|
||||
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.LivingEntity;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
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;
|
||||
|
||||
@Translator(packet = ServerEntityEquipmentPacket.class)
|
||||
@ -55,28 +55,29 @@ public class JavaEntityEquipmentTranslator extends PacketTranslator<ServerEntity
|
||||
}
|
||||
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
ItemData item = ItemTranslator.translateToBedrock(session, packet.getItem());
|
||||
switch (packet.getSlot()) {
|
||||
case HELMET:
|
||||
livingEntity.setHelmet(item);
|
||||
break;
|
||||
case CHESTPLATE:
|
||||
livingEntity.setChestplate(item);
|
||||
break;
|
||||
case LEGGINGS:
|
||||
livingEntity.setLeggings(item);
|
||||
break;
|
||||
case BOOTS:
|
||||
livingEntity.setBoots(item);
|
||||
break;
|
||||
case MAIN_HAND:
|
||||
livingEntity.setHand(item);
|
||||
break;
|
||||
case OFF_HAND:
|
||||
livingEntity.setOffHand(item);
|
||||
break;
|
||||
for (Equipment equipment : packet.getEquipment()) {
|
||||
ItemData item = ItemTranslator.translateToBedrock(session, equipment.getItem());
|
||||
switch (equipment.getSlot()) {
|
||||
case HELMET:
|
||||
livingEntity.setHelmet(item);
|
||||
break;
|
||||
case CHESTPLATE:
|
||||
livingEntity.setChestplate(item);
|
||||
break;
|
||||
case LEGGINGS:
|
||||
livingEntity.setLeggings(item);
|
||||
break;
|
||||
case BOOTS:
|
||||
livingEntity.setBoots(item);
|
||||
break;
|
||||
case MAIN_HAND:
|
||||
livingEntity.setHand(item);
|
||||
break;
|
||||
case OFF_HAND:
|
||||
livingEntity.setOffHand(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
livingEntity.updateEquipment(session);
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren