final Optional<Container> openContainer = player.openInventory();
if (openContainer.isPresent()) {
amount += openContainer.get().query(QueryTypes.ITEM_TYPE, material).totalQuantity();
}
Will give the following error:
[16:11:27] [Server thread/ERROR] [sponge]: Could not pass ChangeInventoryEvent$Pickup$Pre$Impl to battlegrounds
java.lang.ClassCastException: class net.minecraft.world.inventory.ResultContainer cannot be cast to class net.minecraft.world.entity.player.Inventory (net.minecraft.world.inventory.ResultContainer and net.minecraft.world.entity.player.Inventory are in unnamed module of loader cpw.mods.modlauncher.TransformingClassLoader @34819867)
at org.spongepowered.common.inventory.lens.impl.slot.HeldHandSlotLens.getInventoryPlayer(HeldHandSlotLens.java:63) ~[HeldHandSlotLens.class:1.20.6-11.0.0-RC1613]
at org.spongepowered.common.inventory.lens.impl.slot.HeldHandSlotLens.getStack(HeldHandSlotLens.java:68) ~[HeldHandSlotLens.class:1.20.6-11.0.0-RC1613]
at org.spongepowered.common.inventory.query.type.ItemStackQuery.matches(ItemStackQuery.java:48) ~[ItemStackQuery.class:1.20.6-11.0.0-RC1613]
at org.spongepowered.common.inventory.query.SpongeDepthQuery.depthFirstSearch(SpongeDepthQuery.java:65) ~[SpongeDepthQuery.class:1.20.6-11.0.0-RC1613]
at org.spongepowered.common.inventory.query.SpongeDepthQuery.depthFirstSearch(SpongeDepthQuery.java:63) ~[SpongeDepthQuery.class:1.20.6-11.0.0-RC1613]
at org.spongepowered.common.inventory.query.SpongeDepthQuery.depthFirstSearch(SpongeDepthQuery.java:63) ~[SpongeDepthQuery.class:1.20.6-11.0.0-RC1613]
at org.spongepowered.common.inventory.query.SpongeDepthQuery.execute(SpongeDepthQuery.java:52) ~[SpongeDepthQuery.class:1.20.6-11.0.0-RC1613]
at org.spongepowered.common.inventory.query.SpongeQuery.execute(SpongeQuery.java:54) ~[SpongeQuery.class:1.20.6-11.0.0-RC1613]
at org.spongepowered.common.inventory.adapter.impl.DefaultImplementedAdapterInventory.query(DefaultImplementedAdapterInventory.java:231) ~[DefaultImplementedAdapterInventory.class:1.20.6-11.0.0-RC1613]
at org.spongepowered.api.item.inventory.Inventory.query(Inventory.java:342) ~[Inventory.class:1.20.6-11.0.0-RC1613]
Affected Product(s)
SpongeVanilla
Version
1.20.6-11.0.0-RC1613
Operating System
Linux
Java Version
21
Plugins/Mods
Describe the bug
Querying an inventory with:
Will give the following error:
Link to logs
No response