Class StructurePlaceAnimator
java.lang.Object
net.rodofire.easierworldcreator.shapeutil.StructurePlaceAnimator
class to put blocks with an animation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumenum to decide how to play soundsstatic enumenum to determine how much time the structure will be placedstatic enumenum to decide how the order of the blocks -
Constructor Summary
ConstructorsConstructorDescriptionStructurePlaceAnimator(net.minecraft.world.StructureWorldAccess world, StructurePlaceAnimator.AnimatorType animatorType, StructurePlaceAnimator.AnimatorTime animatorTime) init aStructurePlaceAnimatorobject -
Method Summary
Modifier and TypeMethodDescriptionReturns the AnimatorSound object, which manages sounds for the animation.Returns the AnimatorTime object, which manages timing for the animation.Returns the AnimatorType, representing the type of animation.net.minecraft.util.math.Vec3dReturns the axis direction used in the animation.intReturns the number of blocks to place per tick.net.minecraft.util.math.BlockPosReturns the central point of the structure.Returns the random bounds for blocks placed per tick.floatReturns the interval of ticks between sounds during the animation.intgetTicks()Returns the current tick count.net.minecraft.world.StructureWorldAccessgetWorld()Returns the StructureWorldAccess for interacting with the world.voidplace(List<net.minecraft.util.Pair<net.minecraft.block.BlockState, net.minecraft.util.math.BlockPos>> blocksToPlace) Method to handle animated block placement.voidplaceFromBlockList(List<BlockList> blockList) method to place the structure by sorting the BlockList depending on theanimatorTypevoidplaceFromDividedBlockList(List<Set<BlockList>> blockList) method to place the structure by merging and then sorting the BlockList depending on theanimatorTypevoidsetAnimatorSound(StructurePlaceAnimator.AnimatorSound animatorSound) Sets the AnimatorSound object, which manages sounds for the animation.voidsetAnimatorTime(StructurePlaceAnimator.AnimatorTime animatorTime) Sets the AnimatorTime object, which manages timing for the animation.voidsetAnimatorType(StructurePlaceAnimator.AnimatorType animatorType) Sets the AnimatorType, representing the type of animation.voidsetAxisDirection(net.minecraft.util.math.Vec3d axisDirection) Sets the axis direction used in the animation.voidsetBlocksPerTick(int blocksPerTick) Sets the number of blocks to place per tick.voidsetCenterPoint(net.minecraft.util.math.BlockPos centerPoint) Sets the central point of the structure.voidsetRandomBlocksPerTickBound(net.minecraft.util.Pair<Integer, Integer> randomBlocksPerTickBound) Sets the random bounds for blocks placed per tick.voidsetSoundPerTicks(float soundPerTicks) Sets the interval of ticks between sounds during the animation.voidsetTicks(int ticks) Sets the current tick count.voidsetWorld(net.minecraft.world.StructureWorldAccess world) Sets the StructureWorldAccess for interacting with the world.
-
Constructor Details
-
StructurePlaceAnimator
public StructurePlaceAnimator(net.minecraft.world.StructureWorldAccess world, StructurePlaceAnimator.AnimatorType animatorType, StructurePlaceAnimator.AnimatorTime animatorTime) init aStructurePlaceAnimatorobject- Parameters:
world- the world the animation will take placeanimatorType- the type of the animationanimatorTime- the time of the animation
-
-
Method Details
-
getRandomBlocksPerTickBound
Returns the random bounds for blocks placed per tick.- Returns:
- a Pair representing the minimum and maximum number of blocks to be placed per tick.
-
setRandomBlocksPerTickBound
public void setRandomBlocksPerTickBound(net.minecraft.util.Pair<Integer, Integer> randomBlocksPerTickBound) Sets the random bounds for blocks placed per tick.- Parameters:
randomBlocksPerTickBound- a Pair representing the minimum and maximum number of blocks to be placed per tick.
-
getBlocksPerTick
public int getBlocksPerTick()Returns the number of blocks to place per tick.- Returns:
- the number of blocks placed each tick.
-
setBlocksPerTick
public void setBlocksPerTick(int blocksPerTick) Sets the number of blocks to place per tick.- Parameters:
blocksPerTick- the number of blocks placed each tick.
-
getTicks
public int getTicks()Returns the current tick count.- Returns:
- the number of ticks.
-
setTicks
public void setTicks(int ticks) Sets the current tick count.- Parameters:
ticks- the number of ticks.
-
getCenterPoint
public net.minecraft.util.math.BlockPos getCenterPoint()Returns the central point of the structure.- Returns:
- the center point as a BlockPos object.
-
setCenterPoint
public void setCenterPoint(net.minecraft.util.math.BlockPos centerPoint) Sets the central point of the structure.- Parameters:
centerPoint- the center point as a BlockPos object.
-
getAxisDirection
public net.minecraft.util.math.Vec3d getAxisDirection()Returns the axis direction used in the animation.- Returns:
- the axis direction as a Vec3d object.
-
setAxisDirection
public void setAxisDirection(net.minecraft.util.math.Vec3d axisDirection) Sets the axis direction used in the animation.- Parameters:
axisDirection- the axis direction as a Vec3d object.
-
getAnimatorTime
Returns the AnimatorTime object, which manages timing for the animation.- Returns:
- the AnimatorTime object.
-
setAnimatorTime
Sets the AnimatorTime object, which manages timing for the animation.- Parameters:
animatorTime- the AnimatorTime object.
-
getAnimatorType
Returns the AnimatorType, representing the type of animation.- Returns:
- the AnimatorType.
-
setAnimatorType
Sets the AnimatorType, representing the type of animation.- Parameters:
animatorType- the AnimatorType.
-
getWorld
public net.minecraft.world.StructureWorldAccess getWorld()Returns the StructureWorldAccess for interacting with the world.- Returns:
- the StructureWorldAccess object.
-
setWorld
public void setWorld(net.minecraft.world.StructureWorldAccess world) Sets the StructureWorldAccess for interacting with the world.- Parameters:
world- the StructureWorldAccess object.
-
getAnimatorSound
Returns the AnimatorSound object, which manages sounds for the animation.- Returns:
- the AnimatorSound object.
-
setAnimatorSound
Sets the AnimatorSound object, which manages sounds for the animation.- Parameters:
animatorSound- the AnimatorSound object.
-
getSoundPerTicks
public float getSoundPerTicks()Returns the interval of ticks between sounds during the animation.- Returns:
- the interval as a float.
-
setSoundPerTicks
public void setSoundPerTicks(float soundPerTicks) Sets the interval of ticks between sounds during the animation.- Parameters:
soundPerTicks- the interval as a float.
-
placeFromDividedBlockList
method to place the structure by merging and then sorting the BlockList depending on theanimatorType- Parameters:
blockList- the list of BlockList that will be placed
-
placeFromBlockList
method to place the structure by sorting the BlockList depending on theanimatorType- Parameters:
blockList- the list of BlockList that will be placed
-
place
public void place(List<net.minecraft.util.Pair<net.minecraft.block.BlockState, net.minecraft.util.math.BlockPos>> blocksToPlace) Method to handle animated block placement. This has some advantages :
- Since that the placement take many ticks instead of one, it will improve user experience when placing huge structures
- It may look better than just a structure spawning
The method need a
List<Pair<BlockState, BlockPos>>that will be used to place the blocks.The method calculates the number of ticks it will take to place the structure and will then place a part of the structure depending on how much blocks per ticks should be placed.
To place them, it registers an event happening at the end of each world tick.
- Parameters:
blocksToPlace- theList<Pair<>>that will be placed.
-