equipment slots emit eqiup sound
This commit is contained in:
parent
0e83e08ec6
commit
87d9df1ce1
@ -25,7 +25,6 @@ import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper.hasBindingCurse
|
||||
import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import net.minecraftforge.event.network.CustomPayloadEvent
|
||||
import net.minecraftforge.network.PacketDistributor
|
||||
import ru.dbotthepony.mc.otm.capability.IMatteryUpgrade
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
import ru.dbotthepony.mc.otm.capability.UpgradeType
|
||||
@ -298,6 +297,11 @@ abstract class MatteryMenu(
|
||||
open inner class EquipmentSlot(container: Container, index: Int, val type: net.minecraft.world.entity.EquipmentSlot) : InventorySlot(container, index) {
|
||||
constructor(type: net.minecraft.world.entity.EquipmentSlot) : this(inventory, 34 + type.ordinal, type)
|
||||
|
||||
override fun setByPlayer(newItem: ItemStack, oldItem: ItemStack) {
|
||||
inventory.player.onEquipItem(type, oldItem, newItem)
|
||||
super.setByPlayer(newItem, oldItem)
|
||||
}
|
||||
|
||||
override fun mayPlace(itemStack: ItemStack): Boolean {
|
||||
return super.mayPlace(itemStack) && itemStack.canEquip(type, inventory.player)
|
||||
}
|
||||
@ -322,6 +326,11 @@ abstract class MatteryMenu(
|
||||
autoCreateInventoryFrame = autoFrame
|
||||
|
||||
offhandSlot = object : InventorySlot(inventory, 40) {
|
||||
override fun setByPlayer(newItem: ItemStack, oldItem: ItemStack) {
|
||||
inventory.player.onEquipItem(net.minecraft.world.entity.EquipmentSlot.OFFHAND, oldItem, newItem)
|
||||
super.setByPlayer(newItem, oldItem)
|
||||
}
|
||||
|
||||
override fun getNoItemIcon(): Pair<ResourceLocation, ResourceLocation> {
|
||||
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.EMPTY_ARMOR_SLOT_SHIELD)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user