Bug Inventory?

Bug Inventory ?

chest.getInventory().query(QueryOperationTypes.INVENTORY_PROPERTY.of(SlotIndex.of(0))).set(ItemStack.of(ItemTypes.DIAMOND));
chest.getInventory().query(QueryOperationTypes.INVENTORY_PROPERTY.of(SlotIndex.of(1))).set(ItemStack.of(ItemTypes.REDSTONE_BLOCK));
chest.getInventory().query(QueryOperationTypes.INVENTORY_PROPERTY.of(SlotIndex.of(2))).set(ItemStack.of(ItemTypes.TORCH));

1 Like

Yes its a bug. Because a chest inventory is a Grid inventory you can actually use a function for setting slots that dont require you to query every slot.

int x = 0;
int y = 0;
ItemStack stack;
GridInventory inventory = (GridInventory) chest.getInventory();
inventory.set(x, y, stack);

That should fix the bug your having and neaten your code

Grid inventory = SpongeAPI/GridInventory.java at stable-7 · SpongePowered/SpongeAPI · GitHub

Le bug sera résolu quand ?

Google trad:
The bug will be solved when?

Edit:
J’ai l’impression de pas avoir le bug avec ce code:
Google trad:
I have the impression of not having the bug with this code:

                                int i = 0;
                                for(Inventory inventory : chest.getInventory().slots()) {
                                    if(inventorySav.containsKey(i)) {
                                        inventory.set(inventorySav.get(i));
                                    }
                                    i++;
                                }

I am not a developer for sponge, im just a developer of plugins that run on sponge.

If you want the bug fixed then report it to Sponges github issues page