StructurePlaceAnimator - McMellonTeam/easierworldcreator GitHub Wiki

Base

The mod allows you to animate the placement of a structure. To animate your structure, you first need to sort your BlockList comparator $using a BlockSorter

Animation parameters

In order to use the animator you need to define a AnimatorTime and also a AnimatorSound.

AnimatorTime

the animator time define the time your structure will take to be placed. There are many value that you can use:

CONSTANT_BLOCKS_PER_TICK

this will place a constant number of block each tick. To use it, you have to set a number of blockPerTick using setBlocksPerTick()

this graph shows the number of block placed each tick from the start to the end image

LINEAR_BLOCK_PER_TICK

Will place an increasing (or decreasing) number of blocks per ticks linearly. You will have to specify the number of blockPerTicks that will be used based on the following principle:

  • tick0 -> zero blocks placed
  • tick1 -> blockPerTick blocks placed
  • tick2 -> 2 * blockPerTick blocks placed
  • ...

  • tickN-1 -> (N-1) * blockPerTick blocks placed
  • tickN -> min(N * blockPerTick blocks placed, remaining blocks)

to init the animator, You simply have to specify the number of BlockPerTicks this graph shows the evolution of the placed block each tick where blockPerTick = 2

image

QUADRATIC_BLOCK_PER_TICK

Will place an increasing (or decreasing) number of blocks per ticks that will grow on x². You will have to specify the number of blockPerTicks that will be used based on the following principle:

  • tick0 -> zero blocks placed
  • tick1 -> blockPerTick blocks placed
  • tick2 -> 4 * blockPerTick blocks placed (2*2)

    ...

  • tickN-1 -> (N-1) * (N-1) * blockPerTick blocks placed
  • tickN -> min(N * N * blockPerTick blocks placed, remaining blocks)

to init the animator, You simply have to specify the number of BlockPerTicks

the graph shows the evolution of block placed each tick image

RANDOM_BLOCKS_PER_TICK

Will place a random number blocks every tick. For that you need to use the bounds:

animator.setBounds(min_value, max_value);

The animator will then choose a random number of blocks to place each tick.

The random number chose will be contained between the min value and the max value. For example:

//possible values : {5, 6, 7, 8, 9, 10}
animator.setBounds(5,10);

this graph shows one case where the bounds are set between 10 and 30: image

CONSTANT_TICKS

Determines a fixed number of ticks to place the structure.

For that, you need to specify the number of ticks: `setTicks()`.

The structure will then place a number of `blockSize / ticks` block each tick.

LINEAR_TICKS

Will place an increasing (or decreasing) number of blocks per ticks linearly. You have to set a bound of blocks StructurePlaceAnimator.

  • The number of blocks that will be placed on the first tick is the first integer of the pair.
  • The last int of the pair represents the number of blocks that will be placed at the last tick.
The related method will then calculate the coefficients that will determine how much blocks will be placed each tick.

this graph shows an example where startTick = 10 and end = 30 image of course, you can have a decreasing curve

QUADRATIC_TICKS

Will place an increasing (or decreasing) number of blocks per ticks following a quadratic curve. You have to set a bound of blocks {@link StructurePlaceAnimator}.

  • The number of blocks that will be placed on the first tick is the first integer of the pair.
  • The last int of the pair represents the number of blocks that will be placed at the last tick.
The related method will then calculate the coefficients that will determine how much blocks will be placed each tick.

this graph shows an example where you set the start and the end number of block placed each tick image

of course, you can have a decreasing curve

AnimatorSound

this enum determines if the animation should play sound. The sound that will be played correspond to the first block placed the tick

⚠️ **GitHub.com Fallback** ⚠️