Optimized Spell Circles#908
Conversation
Decreased saving/loading times
…that was made obsolete by Playerless Casting
…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 |
There was a problem hiding this comment.
variable names aren't too descriptive here, something better might be slateWait, and greaterCorner / lesserCorner
There was a problem hiding this comment.
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
107cf95 to
7202ed7
Compare
| reachedPositions.add(impetus.getBlockPos()); | ||
| var start = seenGoodPositions.get(0); | ||
|
|
||
| seenGoodPosSet.add(impetus.getBlockPos()); |
There was a problem hiding this comment.
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()), |
There was a problem hiding this comment.
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?
Robotgiggle
left a comment
There was a problem hiding this comment.
I fixed the initialization of the reachedPositions set, and also deprecated BlockEntityAbstractImpetus.getBounds since it's now unused. The rest seems good.
Robotgiggle
left a comment
There was a problem hiding this comment.
AABB issue fixed by properly initializing the corner positions before running the loop to detect the cuboid. Should be all good now.
Replaced
knownPositionswith 2 Block Positions, so a AABB list would not need to be saved and loaded.Made
reachedPositionsinto a long; this is to remove a chunk ban and memory leak issue that happen when a Spell Circle loops for too long.