Class BattleItemScanner.InventoryScanner
java.lang.Object
com.pixelmonmod.pixelmon.api.battles.BattleItemScanner.InventoryScanner
- Enclosing class:
- BattleItemScanner
Class holding functional interface instances which handle the logic of an individual inventory type.
-
Constructor Summary
ConstructorDescriptionInventoryScanner
(Predicate<net.minecraft.world.item.ItemStack> predicate, BattleItemScanner.ItemScanner scanner, BattleItemScanner.ItemFinder finder, BattleItemScanner.ItemConsumer consumer) Constructs a new InventoryScanner. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
collectItems
(net.minecraft.server.level.ServerPlayer player, BagSection section, List<net.minecraft.world.item.ItemStack> inventory, net.minecraft.world.item.ItemStack stack, List<ItemData> items) protected net.minecraft.world.item.ItemStack
consumeItem
(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack inventory, net.minecraft.world.item.ItemStack toMatch) protected net.minecraft.world.item.ItemStack
findItem
(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack inventory, net.minecraft.world.item.ItemStack toMatch) protected boolean
testItem
(net.minecraft.world.item.ItemStack stack)
-
Constructor Details
-
InventoryScanner
public InventoryScanner(Predicate<net.minecraft.world.item.ItemStack> predicate, BattleItemScanner.ItemScanner scanner, BattleItemScanner.ItemFinder finder, BattleItemScanner.ItemConsumer consumer) Constructs a new InventoryScanner.- Parameters:
predicate
- Predicate which returns true for anyItemStack
that is of this inventory type.scanner
- Consumer which scans for matching items, and adds them to a list ofItemData
s.finder
- Function which finds the first matchingItemStack
for a givenItemStack
.consumer
- Function which finds and consumes one of the first matchingItemStack
for a givenItemStack
.
-
-
Method Details
-
testItem
protected boolean testItem(net.minecraft.world.item.ItemStack stack) -
collectItems
protected void collectItems(net.minecraft.server.level.ServerPlayer player, BagSection section, List<net.minecraft.world.item.ItemStack> inventory, net.minecraft.world.item.ItemStack stack, List<ItemData> items) -
findItem
protected net.minecraft.world.item.ItemStack findItem(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack inventory, net.minecraft.world.item.ItemStack toMatch) -
consumeItem
protected net.minecraft.world.item.ItemStack consumeItem(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack inventory, net.minecraft.world.item.ItemStack toMatch)
-