Skip to content

Optimized Spell Circles#908

Merged
Robotgiggle merged 9 commits into
FallingColors:mainfrom
Stick404:CircleOptimization
May 10, 2026
Merged

Optimized Spell Circles#908
Robotgiggle merged 9 commits into
FallingColors:mainfrom
Stick404:CircleOptimization

Conversation

@Stick404
Copy link
Copy Markdown
Contributor

Replaced knownPositions with 2 Block Positions, so a AABB list would not need to be saved and loaded.
Made reachedPositions into a long; this is to remove a chunk ban and memory leak issue that happen when a Spell Circle loops for too long.

Decreased saving/loading times
…that was made obsolete by Playerless Casting
@Stick404 Stick404 mentioned this pull request Jul 16, 2025
…ptimization

# Conflicts:
#	Common/src/main/java/at/petrak/hexcasting/common/blocks/circles/impetuses/BlockEntityRedstoneImpetus.java
public CastingImage currentImage;
public @Nullable UUID caster;
public @Nullable FrozenPigment casterPigment;
// This controls the speed of the current slate
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

variable names aren't too descriptive here, something better might be slateWait, and greaterCorner / lesserCorner

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alright, fixed this. The reachedSlate is just a number of how many slates it has ran, so I feel like changing it to slateWait is not the greatest option? But did change the corners to be more descriptive

@object-Object object-Object force-pushed the main branch 4 times, most recently from 107cf95 to 7202ed7 Compare November 22, 2025 22:04
reachedPositions.add(impetus.getBlockPos());
var start = seenGoodPositions.get(0);

seenGoodPosSet.add(impetus.getBlockPos());
Copy link
Copy Markdown
Member

@Robotgiggle Robotgiggle May 10, 2026

Choose a reason for hiding this comment

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

What exactly is the point of this line? The check on line 143 should have already ensured that the impetus pos is in this set, no?

Is this supposed to be creating a new HashSet to pass to reachedPositions?

new CircleExecutionState(impetus.getBlockPos(), impetus.getStartDirection(), knownPositions,
reachedPositions, start, impetus.getStartDirection(), new CastingImage(), casterUUID, colorizer));
new CircleExecutionState(impetus.getBlockPos(), impetus.getStartDirection(),
seenGoodPosSet, impetus.getBlockPos().offset(impetus.getStartDirection().getNormal()),
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.

Why are we passing the entire set of found circle positions to the reachedPositions parameter of the new CircleExecutionState? Shouldn't this just contain the impetus pos and nothing else?

Copy link
Copy Markdown
Member

@Robotgiggle Robotgiggle left a comment

Choose a reason for hiding this comment

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

I fixed the initialization of the reachedPositions set, and also deprecated BlockEntityAbstractImpetus.getBounds since it's now unused. The rest seems good.

Copy link
Copy Markdown
Member

@Robotgiggle Robotgiggle left a comment

Choose a reason for hiding this comment

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

Never mind, there seems to be a major issue with the bounds/ambit check. The AABB is reporting very weird values when I log it, causing circles to have much larger ambit cuboids than intended.

@github-project-automation github-project-automation Bot moved this from 📋 Backlog to 🏗 In progress in Hex Casting May 10, 2026
Copy link
Copy Markdown
Member

@Robotgiggle Robotgiggle left a comment

Choose a reason for hiding this comment

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

AABB issue fixed by properly initializing the corner positions before running the loop to detect the cuboid. Should be all good now.

@Robotgiggle Robotgiggle added this pull request to the merge queue May 10, 2026
Merged via the queue into FallingColors:main with commit 8691777 May 10, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to ✅ Done in Hex Casting May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants