fix change to discovery not allowing for unstackables

This commit is contained in:
yrsegal@gmail.com 2022-08-22 23:29:22 -04:00
parent 2ae33cf82d
commit 8ea5b53ee2

View file

@ -14,7 +14,6 @@ import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.InteractionHand import net.minecraft.world.InteractionHand
import net.minecraft.world.entity.Entity import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.item.ItemEntity
import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.GameType import net.minecraft.world.level.GameType
@ -157,7 +156,7 @@ data class CastingContext(
val stacksToExamine = DiscoveryHandlers.collectItemSlots(this) val stacksToExamine = DiscoveryHandlers.collectItemSlots(this)
fun matches(stack: ItemStack): Boolean = fun matches(stack: ItemStack): Boolean =
!stack.isEmpty && ItemEntity.areMergable(stack, item) !stack.isEmpty && ItemStack.matches(item, stack)
val presentCount = stacksToExamine.fold(0) { acc, stack -> val presentCount = stacksToExamine.fold(0) { acc, stack ->
acc + if (matches(stack)) stack.count else 0 acc + if (matches(stack)) stack.count else 0