diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f6e96ec..7b0d3dbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - Moved certain lang keys for type iotas from Hexal into MoreIotas, since MoreIotas is what actually implements type iotas. - Phase Block now ensures that the caster has permission to break the target block. - Trade now mishaps if the list contains more than 2 motes, and makes it clear that the list should match a single trade offer. +- The book entry for Craft now clarifies that the lists it uses represent rows in the crafting table. ### Fixed @@ -44,6 +45,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - Fixed the Relay block not dropping when broken. - Fixed an error when a playerless caster tries to create a link. - Fixed an error when passing null or an empty mote to Use Item On. +- Fixed an error when passing a list of the wrong shape to Craft or Preview Craft. - Fixed a variety of broken lang keys in the config menu. - Fixed Trade allowing trades even when not enough input items were present. diff --git a/Common/src/main/java/ram/talia/hexal/common/casting/actions/spells/motes/OpCraftMote.kt b/Common/src/main/java/ram/talia/hexal/common/casting/actions/spells/motes/OpCraftMote.kt index 0f31787d..11966e9b 100644 --- a/Common/src/main/java/ram/talia/hexal/common/casting/actions/spells/motes/OpCraftMote.kt +++ b/Common/src/main/java/ram/talia/hexal/common/casting/actions/spells/motes/OpCraftMote.kt @@ -16,6 +16,7 @@ import net.minecraft.world.inventory.AbstractContainerMenu import net.minecraft.world.inventory.TransientCraftingContainer import net.minecraft.world.item.ItemStack import net.minecraft.world.item.crafting.RecipeType +import net.minecraft.server.level.ServerPlayer import ram.talia.hexal.api.casting.castables.UserDataConstMediaAction import ram.talia.hexal.api.casting.iota.MoteIota import ram.talia.hexal.api.casting.iota.MoteIota.TAG_TEMP_STORAGE @@ -49,7 +50,7 @@ object OpCraftMote : UserDataConstMediaAction { val storage = if (userData.contains(TAG_TEMP_STORAGE)) userData.getUUID(TAG_TEMP_STORAGE) else - env.caster?.let { getBoundStorage(it) } + (env.castingEntity as? ServerPlayer)?.let { getBoundStorage(it) } ?: throw MishapNoBoundStorage() if (!isStorageLoaded(storage)) @@ -92,6 +93,7 @@ object OpCraftMote : UserDataConstMediaAction { val out = Array(9) { _ -> null } for ((idy, iota) in input.map({ listOf(IndexedValue(0, it)) }, { it.withIndex() })) { + if (idy > 2) throw MishapInvalidIota.of(input.map({ it }, { ListIota(it) }), 0, "crafting_recipe") when (iota) { is MoteIota -> out[idy * 3] = iota.selfOrNull() is ListIota -> { diff --git a/Common/src/main/java/ram/talia/hexal/common/casting/actions/spells/motes/OpCraftMotePreview.kt b/Common/src/main/java/ram/talia/hexal/common/casting/actions/spells/motes/OpCraftMotePreview.kt index 04f44e5b..90d316c4 100644 --- a/Common/src/main/java/ram/talia/hexal/common/casting/actions/spells/motes/OpCraftMotePreview.kt +++ b/Common/src/main/java/ram/talia/hexal/common/casting/actions/spells/motes/OpCraftMotePreview.kt @@ -46,6 +46,7 @@ object OpCraftMotePreview : ConstMediaAction { val out = Array(9) { _ -> null } for ((idy, iota) in input.flatMap({ listOf(IndexedValue(0, it)) }, { listOf(IndexedValue(0, it)) }, { it.withIndex() })) { + if (idy > 2) throw MishapInvalidIota.of(input.flatMap({ it }, { it }, { ListIota(it) }), 0, "crafting_recipe") when (iota) { is ItemStackIota -> out[idy * 3] = iota.itemStack.copyWithCount(1) is MoteIota -> out[idy * 3] = iota.record?.toStack() diff --git a/Common/src/main/resources/assets/hexal/lang/en_us.json b/Common/src/main/resources/assets/hexal/lang/en_us.json index 5e34c38e..9911a5a0 100644 --- a/Common/src/main/resources/assets/hexal/lang/en_us.json +++ b/Common/src/main/resources/assets/hexal/lang/en_us.json @@ -39,8 +39,8 @@ "hexcasting.mishap.invalid_value.blockitementityitemframeitem": "a block, item entity, item frame, or mote", "hexcasting.mishap.invalid_value.entity.itemitemframe": "an item entity or item frame", "hexcasting.mishap.invalid_value.int.strictly_positive": "a strictly positive integer", - "hexcasting.mishap.invalid_value.crafting_recipe": "a valid crafting recipe", - "hexcasting.mishap.invalid_value.mote_duplicated": "each mote to appear only once", + "hexcasting.mishap.invalid_value.crafting_recipe": "a list representing a valid crafting recipe", + "hexcasting.mishap.invalid_value.mote_duplicated": "a list without any duplicate motes", "hexcasting.mishap.invalid_value.cant_combine_motes": "two motes that can be combined", "hexcasting.mishap.invalid_value.mote_empty": "a non-empty mote", "hexcasting.mishap.invalid_value.mote_not_size_one": "a mote with no NBT data or of size one", @@ -289,7 +289,7 @@ "hexal.page.motes.mote/split": "Splits the specified number of items off of the passed mote, creating a new mote pointing to a new mote record.", "hexal.page.motes.mote/storage/get": "Get the position of the Mote Nexus that contains the passed mote.", "hexal.page.motes.mote/storage/set": "Move the record referenced by the passed mote to the Mote Nexus at the passed position. This returns a new mote pointing to that record, and invalidates all previous motes pointing to that record.", - "hexal.page.motes.mote/craft.0": "Takes a mote, list of motes, or list of list of motes. returns a list containing the results of crafting with those items. For example, the input Stone x128 would return [Stone Button x128].", + "hexal.page.motes.mote/craft.0": "Takes a mote, a list of up to three motes, or a list of up to three lists of motes. Each list of motes represents one row of the crafting grid. Returns a list containing the results of crafting with those items. For example, the input Stone x128 would return [Stone Button x128].", "hexal.page.motes.mote/craft.1": "For more complex crafts, inserting nulls to space items properly will be required. A diamond pickaxe for example would require [[Diamond x2, Diamond x2, Diamond x2], [null, Stick x2], [null, Stick x2]] to get [Diamond Pickaxe x2]. Costs a tenth of an $(l:items/amethyst)$(item)Amethyst Dust/$.", "hexal.page.motes.mote/craft/preview": "Takes the same input as $(l:patterns/spells/motes#hexal:mote/craft)$(action)Craft/$, except it can take Item Stack Iotas as well as motes. Returns a list of Item Stack Iotas representing what the results of $(l:patterns/spells/motes#hexal:mote/craft)$(action)Craft/$ would have been with motes containing those inputs.", "hexal.page.motes.mote/villager/level/get": "Accepts a villager, returns a number representing that villager's seniority and skill at their craft.",