diff --git a/CHANGELOG.md b/CHANGELOG.md index eea7f33580..44fdc2b73b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## `0.11.4` - ??? + +### Fixed + +- Fixed a crash loop when trying to generate a creative-mode ancient scroll for a Great Spell whose per-world pattern hasn't been calculated yet, by Robotgiggle in [992](https://github.com/FallingColors/HexMod/pull/992) + ## `0.11.3` - 2025-11-22 ### Added diff --git a/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemScroll.java b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemScroll.java index 1bea5dfec5..09a8f44b7c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemScroll.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/items/storage/ItemScroll.java @@ -49,6 +49,7 @@ public class ItemScroll extends Item implements IotaHolderItem { public static final String TAG_OP_ID = "op_id"; public static final String TAG_PATTERN = "pattern"; + public static final String TAG_RECALC_WARNING = "recalc_warning"; public static final String TAG_NEEDS_PURCHASE = "needs_purchase"; public static final ResourceLocation ANCIENT_PREDICATE = modLoc("ancient"); @@ -180,6 +181,12 @@ public void inventoryTick(ItemStack pStack, Level pLevel, Entity pEntity, int pS } var patternKey = ResourceKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), opID); var pat = PatternRegistryManifest.getCanonicalStrokesPerWorld(patternKey, pEntity.getServer().overworld()); + if (pat == null) { + // if pat is null, the per-world order hasn't been registered; remove the op_id and warn the player + NBTHelper.putString(pStack, TAG_RECALC_WARNING, NBTHelper.getString(pStack, TAG_OP_ID)); + NBTHelper.remove(pStack, TAG_OP_ID); + return; + } NBTHelper.put(pStack, TAG_PATTERN, pat.serializeToNBT()); } } @@ -190,6 +197,12 @@ public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List