From eb3484422240c417a2b28927fe31671a1640fa54 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 25 Sep 2022 21:18:15 +0700 Subject: [PATCH] Should have thought of binding curse --- .../kotlin/ru/dbotthepony/mc/otm/core/AwareItemStack.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/AwareItemStack.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/AwareItemStack.kt index 0fb0d5f92..e3850b858 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/AwareItemStack.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/AwareItemStack.kt @@ -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) } } }