From 8ddca1e7eac20506074bd89cf7a1dce571cb5fc3 Mon Sep 17 00:00:00 2001 From: Robotgiggle <88736742+Robotgiggle@users.noreply.github.com> Date: Tue, 26 May 2026 17:39:48 -0400 Subject: [PATCH 1/2] Serialize full item record rather than just display name --- .../ram/talia/hexal/api/casting/iota/MoteIota.java | 12 +++++------- .../ram/talia/hexal/api/mediafieditems/ItemRecord.kt | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Common/src/main/java/ram/talia/hexal/api/casting/iota/MoteIota.java b/Common/src/main/java/ram/talia/hexal/api/casting/iota/MoteIota.java index 6515df98..9689476f 100644 --- a/Common/src/main/java/ram/talia/hexal/api/casting/iota/MoteIota.java +++ b/Common/src/main/java/ram/talia/hexal/api/casting/iota/MoteIota.java @@ -26,8 +26,7 @@ * media. When the item is used up, all references to it become null. */ public class MoteIota extends Iota { - static final String TAG_DISPLAY_NAME = "name"; - static final String TAG_COUNT = "count"; + static final String TAG_ITEM_RECORD = "item_record"; /** * Used to get the UUID of the temporarily bound storage from userData, if one exists. @@ -197,9 +196,7 @@ var record = MediafiedItemManager.getRecord(this.getItemIndex()); if (record == null || (rec = record.get()) == null) return tag; - - tag.putString(TAG_DISPLAY_NAME, rec.getDisplayName().getString()); - tag.putLong(TAG_COUNT, rec.getCount()); + rec.writeToTag(tag); return tag; } @@ -223,10 +220,11 @@ public Component display(Tag tag) { return Component.translatable("hexcasting.spelldata.unknown"); } - if (!ctag.contains(TAG_DISPLAY_NAME) || !ctag.contains(TAG_COUNT)) + var itemRecord = ItemRecord.readFromTag(ctag); + if (itemRecord == null) return Component.translatable("hexcasting.tooltip.null_iota").withStyle(ChatFormatting.GRAY); - return Component.translatable("hexal.spelldata.mote", ctag.getString(TAG_DISPLAY_NAME), ctag.getLong(TAG_COUNT)).withStyle(ChatFormatting.YELLOW); + return Component.translatable("hexal.spelldata.mote", itemRecord.getDisplayName(), itemRecord.getCount()).withStyle(ChatFormatting.YELLOW); } @Override diff --git a/Common/src/main/java/ram/talia/hexal/api/mediafieditems/ItemRecord.kt b/Common/src/main/java/ram/talia/hexal/api/mediafieditems/ItemRecord.kt index 94f19f43..ea6fa353 100644 --- a/Common/src/main/java/ram/talia/hexal/api/mediafieditems/ItemRecord.kt +++ b/Common/src/main/java/ram/talia/hexal/api/mediafieditems/ItemRecord.kt @@ -118,6 +118,7 @@ data class ItemRecord(var item: Item, var tag: CompoundTag?, var count: Long) { /** * Taken from https://github.com/AppliedEnergistics/Applied-Energistics-2/blob/9ff272a869508125daf5727746c9d9b8b00248bd/src/main/java/appeng/api/stacks/AEItemKey.java#L130 */ + @JvmStatic fun readFromTag(tag: CompoundTag): ItemRecord? { return try { val item = BuiltInRegistries.ITEM.getOptional(ResourceLocation(tag.getString(TAG_ITEM_ID))).orElseThrow { IllegalArgumentException("Unknown item id.") } From 9fad88c9bfcaeaa9ad65966f796344219cab7137 Mon Sep 17 00:00:00 2001 From: Robotgiggle <88736742+Robotgiggle@users.noreply.github.com> Date: Tue, 26 May 2026 17:42:44 -0400 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f6e96ec..edaf4995 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. +- Mote iotas now serialize the full item record they contain, rather than just the English display name. ### Fixed