Interface IAnimatedBlockContainer
- All Known Implementing Classes:
AnimatedBlockContainer,AnimatedPreviewBlockContainer
public interface IAnimatedBlockContainer
Represents a manager for animated blocks.
It is responsible for the creation and cleanup of animated blocks.
The most common example will be a manager that replaces existing blocks with animated blocks and places them in the new location after the animation ends.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancreateAnimatedBlocks(StructureSnapshot snapshot, IAnimationComponent animationComponent) Attempts to create and spawn the animated blocks for the given input.@Nullable AnimationRegionGetter for the animation region.voidHandles the blocks when the animation is completed.voidRemoves the original blocks from the world.voidRestores all spawned animated blocks to their original positions.voidTries to replace the original blocks with the animated blocks in the world.
-
Method Details
-
createAnimatedBlocks
Attempts to create and spawn the animated blocks for the given input.- Parameters:
snapshot- The snapshot of the structure to create the animated blocks for.animationComponent- The animation component to use for retrieving additional information for the animated blocks.- Returns:
- The result of the attempted creation of the animated blocks.
-
getAnimatedBlocks
List<IAnimatedBlock> getAnimatedBlocks()- Returns:
- All the animated blocks that are part of the animation. In case an error occurred during the creation, this will contain all the animated blocks that have been created up to the point that the problem occurred.
-
getAnimationRegion
Getter for the animation region.- Returns:
- The animation region.
-
spawnAnimatedBlocks
Tries to replace the original blocks with the animated blocks in the world.This method also handles the removal of the original blocks.
- Throws:
Exception- If something went wrong and the process had to be aborted.
-
removeOriginalBlocks
Removes the original blocks from the world.This method does not have to be called when spawning the animated blocks using
spawnAnimatedBlocks().- Throws:
Exception- If something went wrong while removing the original blocks.
-
restoreBlocksOnFailure
void restoreBlocksOnFailure()Restores all spawned animated blocks to their original positions.Should be used in case something failed.
-
handleAnimationCompletion
void handleAnimationCompletion()Handles the blocks when the animation is completed.For the most common use-case, this means that the animated blocks will be killed and the blocks they represented will be placed in their final positions.
-