diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt index 7d1410a55..d35104dab 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadOffhandItem.kt @@ -17,10 +17,10 @@ class MishapBadOffhandItem(val item: ItemStack?, val wanted: Component) : Mishap env.mishapEnvironment.dropHeldItems() } - override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = if (item?.isEmpty != false) - error("no_item.offhand", wanted) - else + override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) = if (item?.isEmpty == false) error("bad_item.offhand", wanted, item.count, item.displayName) + else + error("no_item.offhand", wanted) companion object { @JvmStatic diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/DoubleArithmetic.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/DoubleArithmetic.kt index 07da240b2..075a17a76 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/DoubleArithmetic.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/arithmetic/DoubleArithmetic.kt @@ -57,6 +57,7 @@ object DoubleArithmetic : Arithmetic { MUL -> make2 { a, b -> a * b } DIV -> make2 { a, b -> if (b == 0.0) throw MishapDivideByZero.of(a, b) else a / b } ABS -> make1 { a -> abs(a) } + // throw MishapDivideByZero if raising a negative number to a fractional power (ie. sqrt(-1) etc) POW -> make2 { a, b -> if (a < 0 && !DoubleIota.tolerates(floor(b), b)) throw MishapDivideByZero.of(a, b, "exponent") else a.pow(b) } FLOOR -> make1 { a -> floor(a) } CEIL -> make1 { a -> ceil(a) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemFocus.java b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemFocus.java index 424eccadc..8d08c9923 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemFocus.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemFocus.java @@ -45,7 +45,7 @@ public String getDescriptionId(ItemStack stack) { @Override public boolean writeable(ItemStack stack) { - return !NBTHelper.getBoolean(stack, TAG_SEALED); + return !isSealed(stack); } @Override