From f57ccafcfad2d5cdef7f5b9e8811afb7d7a421ae Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sat, 29 Mar 2025 17:06:01 +0700 Subject: [PATCH] Fix player not getting advancements for items picked up into exopack inventory --- .../ru/dbotthepony/mc/otm/player/ExopackContainer.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) }