Should have thought of binding curse
This commit is contained in:
parent
0f173922a5
commit
eb34844222
@ -1,7 +1,9 @@
|
||||
package ru.dbotthepony.mc.otm.core
|
||||
|
||||
import net.minecraft.world.Container
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper.hasBindingCurse
|
||||
import net.minecraftforge.items.IItemHandler
|
||||
import ru.dbotthepony.mc.otm.container.get
|
||||
import ru.dbotthepony.mc.otm.container.set
|
||||
@ -27,6 +29,10 @@ data class ContainerItemStackEntry(val index: Int, val container: Container) : A
|
||||
}
|
||||
|
||||
override fun extract(amount: Int, simulate: Boolean): ItemStack {
|
||||
if (container is Inventory && index in 36 .. 39 && hasBindingCurse(container[index])) {
|
||||
return ItemStack.EMPTY
|
||||
}
|
||||
|
||||
if (simulate) {
|
||||
return container[index].let { if (it.isEmpty) it else it.copy().also { it.count = it.count.coerceAtMost(amount) } }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user