From c9ef3e635b7c5486122ccab4cda5d6e4fbc01c34 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sat, 8 Jul 2023 01:03:13 +0700 Subject: [PATCH] Make exopack smelters drop their slots and lose current progress on death --- .../otm/capability/MatteryPlayerCapability.kt | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt index d1737afff..0dd420e4a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt @@ -1582,11 +1582,13 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial @JvmStatic fun inventoryDropAll(inventory: Inventory) { - if (inventory.player.matteryPlayer?.hasExoPack == false) { + val mattery = inventory.player.matteryPlayer ?: return + + if (!mattery.hasExoPack) { return } - val iterator = inventory.player.matteryPlayer?.exoPackContainer?.iterator() ?: return + val iterator = mattery.exoPackContainer.iterator() for (item in iterator) { if (!item.isEmpty) { @@ -1594,6 +1596,20 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial iterator.remove() } } + + for (smelter in mattery.smelters) { + if (!smelter.input[0].isEmpty) { + inventory.player.drop(smelter.input[0], true, false) + smelter.input[0] = ItemStack.EMPTY + } + + if (!smelter.output[0].isEmpty) { + inventory.player.drop(smelter.output[0], true, false) + smelter.output[0] = ItemStack.EMPTY + } + + smelter.currentJob = null + } } @JvmStatic