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 chestplate = ItemData.AIR;
|
||||||
protected ItemData leggings = ItemData.AIR;
|
protected ItemData leggings = ItemData.AIR;
|
||||||
protected ItemData boots = ItemData.AIR;
|
protected ItemData boots = ItemData.AIR;
|
||||||
|
protected ItemData body = ItemData.AIR;
|
||||||
protected ItemData hand = ItemData.AIR;
|
protected ItemData hand = ItemData.AIR;
|
||||||
protected ItemData offhand = ItemData.AIR;
|
protected ItemData offhand = ItemData.AIR;
|
||||||
|
|
||||||
|
@ -112,6 +113,10 @@ public class LivingEntity extends Entity {
|
||||||
this.chestplate = ItemTranslator.translateToBedrock(session, stack);
|
this.chestplate = ItemTranslator.translateToBedrock(session, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBody(ItemStack stack) {
|
||||||
|
this.body = ItemTranslator.translateToBedrock(session, stack);
|
||||||
|
}
|
||||||
|
|
||||||
public void setLeggings(ItemStack stack) {
|
public void setLeggings(ItemStack stack) {
|
||||||
this.leggings = ItemTranslator.translateToBedrock(session, stack);
|
this.leggings = ItemTranslator.translateToBedrock(session, stack);
|
||||||
}
|
}
|
||||||
|
@ -323,6 +328,7 @@ public class LivingEntity extends Entity {
|
||||||
armorEquipmentPacket.setChestplate(chestplate);
|
armorEquipmentPacket.setChestplate(chestplate);
|
||||||
armorEquipmentPacket.setLeggings(leggings);
|
armorEquipmentPacket.setLeggings(leggings);
|
||||||
armorEquipmentPacket.setBoots(boots);
|
armorEquipmentPacket.setBoots(boots);
|
||||||
|
armorEquipmentPacket.setBody(body);
|
||||||
|
|
||||||
session.sendUpstreamPacket(armorEquipmentPacket);
|
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.LivingEntity;
|
||||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||||
import org.geysermc.geyser.item.Items;
|
import org.geysermc.geyser.item.Items;
|
||||||
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.skin.FakeHeadProvider;
|
import org.geysermc.geyser.skin.FakeHeadProvider;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
|
@ -72,11 +73,19 @@ public class JavaSetEquipmentTranslator extends PacketTranslator<ClientboundSetE
|
||||||
livingEntity.setHelmet(stack);
|
livingEntity.setHelmet(stack);
|
||||||
armorUpdated = true;
|
armorUpdated = true;
|
||||||
}
|
}
|
||||||
case CHESTPLATE, BODY -> {
|
case CHESTPLATE -> {
|
||||||
// BODY is sent for llamas with a carpet equipped, as of 1.20.5
|
|
||||||
livingEntity.setChestplate(stack);
|
livingEntity.setChestplate(stack);
|
||||||
armorUpdated = true;
|
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 -> {
|
case LEGGINGS -> {
|
||||||
livingEntity.setLeggings(stack);
|
livingEntity.setLeggings(stack);
|
||||||
armorUpdated = true;
|
armorUpdated = true;
|
||||||
|
|
Loading…
Reference in a new issue