Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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());
}
}
Expand All @@ -190,6 +197,12 @@ public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List<Compo
if (NBTHelper.getBoolean(pStack, TAG_NEEDS_PURCHASE)) {
var needsPurchase = Component.translatable("hexcasting.tooltip.scroll.needs_purchase");
pTooltipComponents.add(needsPurchase.withStyle(ChatFormatting.GRAY));
} else if (NBTHelper.hasString(pStack, TAG_RECALC_WARNING)) {
var spellName = Component.translatable("hexcasting.action." + ResourceLocation.tryParse(NBTHelper.getString(pStack, TAG_RECALC_WARNING)));
var line1 = Component.translatable("hexcasting.tooltip.scroll.recalc_warning.line1", spellName);
var line2 = Component.translatable("hexcasting.tooltip.scroll.recalc_warning.line2");
pTooltipComponents.add(line1.withStyle(ChatFormatting.RED));
pTooltipComponents.add(line2.withStyle(ChatFormatting.RED));
} else if (NBTHelper.hasString(pStack, TAG_OP_ID) && !NBTHelper.hasCompound(pStack, TAG_PATTERN)) {
var notLoaded = Component.translatable("hexcasting.tooltip.scroll.pattern_not_loaded");
pTooltipComponents.add(notLoaded.withStyle(ChatFormatting.GRAY));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@
scroll: {
needs_purchase: "Purchase to show pattern",
pattern_not_loaded: "Place in inventory to load pattern",
"recalc_warning.line1": "The per-world pattern for %s has not been calculated yet!",
"recalc_warning.line2": "Please run /hexcasting recalcPatterns, then grab a new scroll.",
},

abacus: {
Expand Down
Loading