fix a dumb stupid crash, thanks forge, i hate it
This commit is contained in:
parent
10f16e9199
commit
9561391995
2 changed files with 8 additions and 0 deletions
|
@ -9,6 +9,8 @@ object ManaHelper {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isManaItem(stack: ItemStack): Boolean {
|
fun isManaItem(stack: ItemStack): Boolean {
|
||||||
val manaHolder = IXplatAbstractions.INSTANCE.findManaHolder(stack) ?: return false
|
val manaHolder = IXplatAbstractions.INSTANCE.findManaHolder(stack) ?: return false
|
||||||
|
if (!manaHolder.canProvide())
|
||||||
|
return false
|
||||||
return manaHolder.withdrawMana(-1, true) > 0
|
return manaHolder.withdrawMana(-1, true) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,9 +56,15 @@ class OpMakePackagedSpell<T : ItemPackagedHex>(val itemType: T, val cost: Int) :
|
||||||
private inner class Spell(val itemEntity: ItemEntity, val patterns: List<HexPattern>) : RenderedSpell {
|
private inner class Spell(val itemEntity: ItemEntity, val patterns: List<HexPattern>) : RenderedSpell {
|
||||||
override fun cast(ctx: CastingContext) {
|
override fun cast(ctx: CastingContext) {
|
||||||
val (handStack) = ctx.getHeldItemToOperateOn { it.`is`(itemType) }
|
val (handStack) = ctx.getHeldItemToOperateOn { it.`is`(itemType) }
|
||||||
|
<<<<<<< HEAD:Common/src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt
|
||||||
val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(handStack)
|
val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(handStack)
|
||||||
if (hexHolder != null
|
if (hexHolder != null
|
||||||
&& hexHolder.patterns == null
|
&& hexHolder.patterns == null
|
||||||
|
=======
|
||||||
|
val spellHolder = HexCapabilities.getCapability(handStack, HexCapabilities.SPELL)
|
||||||
|
if (spellHolder.isPresent
|
||||||
|
&& spellHolder.get().patterns == null
|
||||||
|
>>>>>>> 0d81ef8 (fix a dumb stupid crash, thanks forge, i hate it):src/main/java/at/petrak/hexcasting/common/casting/operators/spells/OpMakePackagedSpell.kt
|
||||||
&& itemEntity.isAlive
|
&& itemEntity.isAlive
|
||||||
) {
|
) {
|
||||||
val entityStack = itemEntity.item.copy()
|
val entityStack = itemEntity.item.copy()
|
||||||
|
|
Loading…
Reference in a new issue