Get rid of top hook declaration
This commit is contained in:
parent
a4a965b33c
commit
6cee8e4acf
@ -61,35 +61,6 @@ import kotlin.collections.ArrayDeque
|
|||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
import kotlin.collections.HashMap
|
import kotlin.collections.HashMap
|
||||||
|
|
||||||
/**
|
|
||||||
* this method is hooked through coremod transformer
|
|
||||||
*/
|
|
||||||
fun inventoryAddItemHook(inventory: Inventory, item: ItemStack) {
|
|
||||||
if (item.isEmpty) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val it = inventory.player.matteryPlayer ?: return
|
|
||||||
|
|
||||||
if (!it.hasExoSuit) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val leftover = it.exoSuitContainer.addItem(item, false)
|
|
||||||
item.count = leftover.count
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* this method is hooked through coremod transformer
|
|
||||||
*/
|
|
||||||
fun inventoryAddDamagedItemHook(determinedSlot: Int, inventory: Inventory, item: ItemStack) {
|
|
||||||
if (determinedSlot > 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
inventoryAddItemHook(inventory, item)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerializable<CompoundTag> {
|
class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerializable<CompoundTag> {
|
||||||
private inner class PlayerMatteryContainer(size: Int) : MatteryContainer(size) {
|
private inner class PlayerMatteryContainer(size: Int) : MatteryContainer(size) {
|
||||||
@ -914,5 +885,36 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this method is hooked through coremod transformer
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun inventoryAddItemHook(inventory: Inventory, item: ItemStack) {
|
||||||
|
if (item.isEmpty) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val it = inventory.player.matteryPlayer ?: return
|
||||||
|
|
||||||
|
if (!it.hasExoSuit) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val leftover = it.exoSuitContainer.addItem(item, false)
|
||||||
|
item.count = leftover.count
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this method is hooked through coremod transformer
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun inventoryAddDamagedItemHook(determinedSlot: Int, inventory: Inventory, item: ItemStack) {
|
||||||
|
if (determinedSlot > 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
inventoryAddItemHook(inventory, item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ function injectInventoryInsertHook(
|
|||||||
// dispatching hook method
|
// dispatching hook method
|
||||||
next = new MethodInsnNode(
|
next = new MethodInsnNode(
|
||||||
opcodesRemapped.invokestatic,
|
opcodesRemapped.invokestatic,
|
||||||
'ru/dbotthepony/mc/otm/capability/MatteryPlayerCapabilityKt',
|
'ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability',
|
||||||
hookName,
|
hookName,
|
||||||
hookDesc,
|
hookDesc,
|
||||||
false
|
false
|
||||||
|
Loading…
Reference in New Issue
Block a user