wands are required to cast spells

This commit is contained in:
yrsegal@gmail.com 2022-04-09 22:21:00 -04:00
parent 86e2cb4ee1
commit 518dec0da4

View file

@ -91,6 +91,16 @@ class GuiSpellcasting(private val handOpenedWith: InteractionHand,
soundManager.play(this.ambianceSoundInstance!!)
}
override fun tick() {
val minecraft = Minecraft.getInstance()
val player = minecraft.player
if (player != null) {
val heldItem = player.getItemInHand(handOpenedWith)
if (heldItem.isEmpty || heldItem.item !is ItemWand)
onClose()
}
}
override fun mouseClicked(mxOut: Double, myOut: Double, pButton: Int): Boolean {
if (super.mouseClicked(mxOut, myOut, pButton)) {
return true