diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/ExopackContainer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/ExopackContainer.kt index f2477935a..945f76272 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/ExopackContainer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/ExopackContainer.kt @@ -1,10 +1,13 @@ package ru.dbotthepony.mc.otm.player +import net.minecraft.server.level.ServerPlayer import net.minecraft.world.item.Item +import net.minecraft.world.item.ItemStack import ru.dbotthepony.mc.otm.container.EnhancedContainer import ru.dbotthepony.mc.otm.container.IContainerSlot import ru.dbotthepony.mc.otm.container.IEnhancedContainer import ru.dbotthepony.mc.otm.container.ItemFilter +import ru.dbotthepony.mc.otm.triggers.MatteryInventoryChangeTrigger class ExopackContainer(size: Int, val player: MatteryPlayer) : EnhancedContainer(size) { private inner class Slot(slot: Int) : IContainerSlot.Simple(slot, this@ExopackContainer), IPlayerInventorySlot { @@ -17,6 +20,13 @@ class ExopackContainer(size: Int, val player: MatteryPlayer) : EnhancedContainer set(value) { if (value.allowAll) player.slotFilters.remove(PlayerInventoryWrapper.SLOTS + slot) else player.slotFilters[PlayerInventoryWrapper.SLOTS + slot] = value } } + override fun notifySlotChanged(slot: Int, old: ItemStack) { + super.notifySlotChanged(slot, old) + + if (player.ply is ServerPlayer) + MatteryInventoryChangeTrigger.trigger(player.ply, this, this[slot]) + } + override fun containerSlot(slot: Int): IPlayerInventorySlot { return Slot(slot) }