mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix armor not being visible on 1.21.20
This commit is contained in:
parent
ee43ef8369
commit
8f7d512073
2 changed files with 17 additions and 2 deletions
|
@ -74,6 +74,7 @@ public class LivingEntity extends Entity {
|
|||
protected ItemData chestplate = ItemData.AIR;
|
||||
protected ItemData leggings = ItemData.AIR;
|
||||
protected ItemData boots = ItemData.AIR;
|
||||
protected ItemData body = ItemData.AIR;
|
||||
protected ItemData hand = ItemData.AIR;
|
||||
protected ItemData offhand = ItemData.AIR;
|
||||
|
||||
|
@ -112,6 +113,10 @@ public class LivingEntity extends Entity {
|
|||
this.chestplate = ItemTranslator.translateToBedrock(session, stack);
|
||||
}
|
||||
|
||||
public void setBody(ItemStack stack) {
|
||||
this.body = ItemTranslator.translateToBedrock(session, stack);
|
||||
}
|
||||
|
||||
public void setLeggings(ItemStack stack) {
|
||||
this.leggings = ItemTranslator.translateToBedrock(session, stack);
|
||||
}
|
||||
|
@ -323,6 +328,7 @@ public class LivingEntity extends Entity {
|
|||
armorEquipmentPacket.setChestplate(chestplate);
|
||||
armorEquipmentPacket.setLeggings(leggings);
|
||||
armorEquipmentPacket.setBoots(boots);
|
||||
armorEquipmentPacket.setBody(body);
|
||||
|
||||
session.sendUpstreamPacket(armorEquipmentPacket);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.geysermc.geyser.entity.type.Entity;
|
|||
import org.geysermc.geyser.entity.type.LivingEntity;
|
||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.skin.FakeHeadProvider;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
|
@ -72,11 +73,19 @@ public class JavaSetEquipmentTranslator extends PacketTranslator<ClientboundSetE
|
|||
livingEntity.setHelmet(stack);
|
||||
armorUpdated = true;
|
||||
}
|
||||
case CHESTPLATE, BODY -> {
|
||||
// BODY is sent for llamas with a carpet equipped, as of 1.20.5
|
||||
case CHESTPLATE -> {
|
||||
livingEntity.setChestplate(stack);
|
||||
armorUpdated = true;
|
||||
}
|
||||
case BODY -> {
|
||||
// BODY is sent for llamas with a carpet equipped, as of 1.20.5
|
||||
if (GameProtocol.isPre1_21_2(session)) {
|
||||
livingEntity.setChestplate(stack);
|
||||
} else {
|
||||
livingEntity.setBody(stack);
|
||||
}
|
||||
armorUpdated = true;
|
||||
}
|
||||
case LEGGINGS -> {
|
||||
livingEntity.setLeggings(stack);
|
||||
armorUpdated = true;
|
||||
|
|
Loading…
Reference in a new issue