3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-25 15:50:14 +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 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);
}

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