#Display problem with my UI

1 messages · Page 1 of 1 (latest)

young vault
#

I made a lookinventory system and I display the inventory content of the selected player in a UI using the Herobrine UI pack but I have a display problem. The texture of some displayed blocks is correct, but the texture of the items doesn't match. Does anyone have a solution ?

#

My inventory :

#

Displaying my inventory in the UI :

young vault
#

Can anyone help me ?

lament canyon
#

can you give us the code you used so we can help you fix the issue?

pearl stump
#

you have to shift the aux id offset by the ammount of custom items you have in your pack

young vault
# lament canyon can you give us the code you used so we can help you fix the issue?
async function showPlayerInventory(sender, target) {
    const inventory = target.getComponent('inventory').container;
    const invForm = new ChestFormData('large').title(`Inventory of ${target.name}`);

    for (let i = 0; i < inventory.size; i++) {
        const item = inventory.getItem(i);
        if (!item) continue;
        invForm.button(i + (i < 9 ? 36 : 0), item.nameTag ?? item.typeId, item.getLore(), item.typeId, item.amount);
    }

    await invForm.show(sender);
}
young vault
open shoal
young vault
open shoal
graceful knot
#

Why i + (i <9 ? 36 : 0) ?

young vault
#

And as this is displayed in a UI similar to a large chest interface, and this slot selection centers the player's inventory in this UI

graceful knot
#

Just use i ?

#

Not condition but