File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/main/java/org/spongepowered/common/inventory/query/type Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -46,12 +46,15 @@ public GridQuery(Vector2i offset, Vector2i size) {
4646 @ Override
4747 public Inventory execute (Inventory inventory , InventoryAdapter adapter ) {
4848
49- if (!(adapter instanceof GridInventoryAdapter )) {
49+ final GridInventoryAdapter gridAdapter ;
50+ if (adapter instanceof GridInventoryAdapter ) {
51+ gridAdapter = (GridInventoryAdapter ) adapter ;
52+ } else if (adapter .inventoryAdapter$getRootLens () instanceof GridInventoryLens gridInventoryLens ) {
53+ gridAdapter = (GridInventoryAdapter ) gridInventoryLens .getAdapter (adapter .inventoryAdapter$getFabric (), inventory );
54+ } else {
5055 return new EmptyInventoryImpl (inventory );
5156 }
5257
53- GridInventoryAdapter gridAdapter = (GridInventoryAdapter ) adapter ;
54-
5558 Vector2i max = gridAdapter .dimensions ();
5659 if (max .x () < this .offset .x () + this .size .x () && max .y () < this .offset .y () + this .size .y ()) {
5760 // queried grid does not fit inventory
You can’t perform that action at this time.
0 commit comments