Skip to content

Add proper support for escape manipulation by Actions#1047

Open
Robotgiggle wants to merge 5 commits into
mainfrom
paren-refactor
Open

Add proper support for escape manipulation by Actions#1047
Robotgiggle wants to merge 5 commits into
mainfrom
paren-refactor

Conversation

@Robotgiggle
Copy link
Copy Markdown
Member

Adds the operateInParens method to allow Actions to define custom behavior when executed inside parentheses, and removes all the hardcoded jank that was used to do this before.

This enables the previously hardcoded patterns for escape manipulation (Consideration, Introspection, Retrospection, and Evanition) to be turned into normal Actions, and also makes it possible to add new escape manipulators in addons or future updates.

Copy link
Copy Markdown
Member

@object-Object object-Object left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't fully review (am on a phone), but skimmed and noticed some problematic breaking changes.

* If the iota *is* within parentheses, it will instead be added to the parenthesized list.
* Iotas can also be escaped using Consideration, but that's handled in {@link CastingVM#executeInner}.
*/
public @NotNull CastResult execute(CastingVM vm, ServerLevel world, SpellContinuation continuation) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a breaking change - any addon that implements custom iota execution (and also ContinuationIota) will now execute their unescaped behaviour inside of parentheses until patched. Likely we should do the same thing as with Action (ie add an executeInParens method).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! This has now been fixed.

@@ -6,7 +6,7 @@ import at.petrak.hexcasting.api.casting.iota.PatternIota
import at.petrak.hexcasting.api.pigment.FrozenPigment
import net.minecraft.world.item.DyeColor

class MishapTooManyCloseParens : Mishap() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically renaming this class is a breaking change, though I'm not sure any addons would be using it. Would be worth at least doing a GitHub search to check.

Copy link
Copy Markdown
Member Author

@Robotgiggle Robotgiggle May 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on GitHub search, the only addon that uses MishapTooManyCloseParens is HexThings - but HexThings also has a mixin to CastingVM.handleParentheses, so this PR breaks it even without the name change.

Comment thread Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java
@github-project-automation github-project-automation Bot moved this from 📋 Backlog to 🏗 In progress in Hex Casting May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

2 participants