3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-16 04:50:07 +01:00

Fix armor not being visible on 1.21.20

Dieser Commit ist enthalten in:
Camotoy 2024-08-13 13:42:20 -04:00
Ursprung ee43ef8369
Commit 8f7d512073
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 17 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -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);
} }

Datei anzeigen

@ -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;