Bug Inventory?


#1

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


#2

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 = https://github.com/SpongePowered/SpongeAPI/blob/stable-7/src/main/java/org/spongepowered/api/item/inventory/type/GridInventory.java


#3

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++;
                                }

#4

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