mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-29 15:49:09 +01:00
Fix horse inventory
This commit is contained in:
parent
3f499e3ec0
commit
9d8edad9fc
1 changed files with 9 additions and 5 deletions
|
@ -112,19 +112,23 @@ public class JavaHorseScreenOpenTranslator extends PacketTranslator<ClientboundH
|
|||
NbtMapBuilder builder = NbtMap.builder();
|
||||
List<NbtMap> slots = new ArrayList<>();
|
||||
|
||||
// Since 1.20.5, the armor slot is not included in the container size,
|
||||
// but everything is still indexed the same.
|
||||
int slotCount = packet.getNumberOfSlots() + 1;
|
||||
|
||||
InventoryTranslator inventoryTranslator;
|
||||
if (entity instanceof LlamaEntity) {
|
||||
inventoryTranslator = new LlamaInventoryTranslator(packet.getNumberOfSlots());
|
||||
inventoryTranslator = new LlamaInventoryTranslator(slotCount);
|
||||
slots.add(CARPET_SLOT);
|
||||
} else if (entity instanceof ChestedHorseEntity) {
|
||||
inventoryTranslator = new DonkeyInventoryTranslator(packet.getNumberOfSlots());
|
||||
inventoryTranslator = new DonkeyInventoryTranslator(slotCount);
|
||||
slots.add(SADDLE_SLOT);
|
||||
} else if (entity instanceof CamelEntity) {
|
||||
// The camel has an invisible armor slot and needs special handling, same as the donkey
|
||||
inventoryTranslator = new DonkeyInventoryTranslator(packet.getNumberOfSlots());
|
||||
inventoryTranslator = new DonkeyInventoryTranslator(slotCount);
|
||||
slots.add(SADDLE_SLOT);
|
||||
} else {
|
||||
inventoryTranslator = new HorseInventoryTranslator(packet.getNumberOfSlots());
|
||||
inventoryTranslator = new HorseInventoryTranslator(slotCount);
|
||||
slots.add(SADDLE_SLOT);
|
||||
slots.add(ARMOR_SLOT);
|
||||
}
|
||||
|
@ -136,6 +140,6 @@ public class JavaHorseScreenOpenTranslator extends PacketTranslator<ClientboundH
|
|||
session.sendUpstreamPacket(updateEquipPacket);
|
||||
|
||||
session.setInventoryTranslator(inventoryTranslator);
|
||||
InventoryUtils.openInventory(session, new Container(entity.getNametag(), packet.getContainerId(), packet.getNumberOfSlots(), null, session.getPlayerInventory()));
|
||||
InventoryUtils.openInventory(session, new Container(entity.getNametag(), packet.getContainerId(), slotCount, null, session.getPlayerInventory()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue