Caching

This page was last updated for version v1.2.0

Description

For better optimization, we added an option that calculates and caches all mathematical equations when the effect is loaded.

The best use case for "caching" is when all mathematical equations always yield the same value. For example, if your mathematical equation does not have dynamic variables such as random variables or a player's position, you can enable this feature.

You'll get a warning message on console if your effect has nothing to cache.

Example

effects:
  rainbow-flag:
    display-name: "%rainbow-flag%"
    color-animation: "rainbow"
    permission: "%rainbow-effects%"
    variables: [ 'r', 'x' ]
    enable-caching: true
    interval: 1
    on-tick:
      elytra:
        event: ELYTRA
        times: 16
        scripts:
          - var r={PI}*{i}/16
          - var x=cos({r})
          - particle [effect=minecraft:dust,direction=true,pos={x={x};y=-0.5},amount=10,origin=head*-1.25,color={name=rainbow;speed=0.075}]

Last updated