inventory-framework icon indicating copy to clipboard operation
inventory-framework copied to clipboard

Index 54 out of bounds for length 54

Open goncalodelima opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

🐛 Describe the bug

Tenho este erro ao preencher o inventário inteiro (tem que preencher todo o inventário).

public class UnlockInventory extends View {

private final Configuration inventory;
private final ItemStack decoration = new ItemBuilder(Material.STAINED_GLASS_PANE)
        .setDisplayName("§0§l")
        .build();

public UnlockInventory(Configuration inventory) {
    this.inventory = inventory;
}

@Override
public void onFirstRender(@NotNull RenderContext render) {

    for (int i = 0; i < 54; i++) {
        render.slot(i, decoration);
    }


}

@Override
public void onInit(ViewConfigBuilder config) {
    config
            .title("Unlock")
            .size(54)
            .cancelOnClick()
            .cancelOnDrag()
            .cancelOnDrop()
            .cancelOnPickup()
            .build();
}

}

Erro: image

✔️ Expected behavior

No response

👣 Steps to Reproduce

No response

💻 Platform

  • [X] Bukkit
  • [ ] Sponge
  • [ ] Other

⭐ Server Version

1.8.9

📚 Library Version

latest

✍️ Additional context

No response

goncalodelima avatar Dec 25 '24 21:12 goncalodelima

@goncalodelima Natan is not active in this repo... Can u pls open a PR with steps to reproduce in the example plugin

nicolube avatar Jan 21 '25 06:01 nicolube

I recoment using layouts instad.

nicolube avatar Jan 21 '25 06:01 nicolube

going through the same issuing, trying to list items from slot [0-4] in hopper type inventory, it throws that exception on opening, fixed using availableSlot but that removes the ability of having the slot in config, might change it to layout.

LuxCubeX avatar Apr 11 '25 14:04 LuxCubeX

@DevNatan

goncalodelima avatar May 13 '25 21:05 goncalodelima