Fix player not getting advancements for items picked up into exopack inventory
This commit is contained in:
parent
f82c7977fa
commit
f57ccafcfa
@ -1,10 +1,13 @@
|
|||||||
package ru.dbotthepony.mc.otm.player
|
package ru.dbotthepony.mc.otm.player
|
||||||
|
|
||||||
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import net.minecraft.world.item.Item
|
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.EnhancedContainer
|
||||||
import ru.dbotthepony.mc.otm.container.IContainerSlot
|
import ru.dbotthepony.mc.otm.container.IContainerSlot
|
||||||
import ru.dbotthepony.mc.otm.container.IEnhancedContainer
|
import ru.dbotthepony.mc.otm.container.IEnhancedContainer
|
||||||
import ru.dbotthepony.mc.otm.container.ItemFilter
|
import ru.dbotthepony.mc.otm.container.ItemFilter
|
||||||
|
import ru.dbotthepony.mc.otm.triggers.MatteryInventoryChangeTrigger
|
||||||
|
|
||||||
class ExopackContainer(size: Int, val player: MatteryPlayer) : EnhancedContainer<IPlayerInventorySlot>(size) {
|
class ExopackContainer(size: Int, val player: MatteryPlayer) : EnhancedContainer<IPlayerInventorySlot>(size) {
|
||||||
private inner class Slot(slot: Int) : IContainerSlot.Simple(slot, this@ExopackContainer), IPlayerInventorySlot {
|
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 }
|
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 {
|
override fun containerSlot(slot: Int): IPlayerInventorySlot {
|
||||||
return Slot(slot)
|
return Slot(slot)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user