Change inventory archetype


#1

When copying inventory, the archetype changes from DOUBLE_CHEST to UNKNOWN.
How would I be able to change that in the Inventory object?

I get the new inventory from the event.getTargetInventory().first(), which returns opened double chest’s inventory, but sets it’s archetype to UNKNOWN.

Kind regards, MGlolenstine


#2

Why are you using .first()? And how are you coping the inventory?


#3

I’m just taking the Inventory that I receive from the above command and store it, and I’m using the Inventory#first() because I believe that it returns the first inventory in the opened “inventory”, in this case first would be the chest’s and the second, next or last would be player’s inventories. Am I wrong in assuming that?


#4

Its not guaranteed. The best idea is to use a Query on the inventory. Take a look at QueryOperationTypes for a guaranteed match.