๐Ÿ’š
Treasure Particles
  • Home Page
  • Discord Server
  • Download
    • ๐ŸงกBuiltByBit
  • Effects
    • Basic Usage
    • Creating Effect
      • Caching
      • Variables
      • Tick Handlers
        • Events
        • Mixer Options
      • Script Types
        • Variable
        • Variable Cycle
        • Particle
          • Single Particle
          • Circle Particle
            • Spread Particle
            • Targeted Circle Particle
          • Spiral Effects
            • Spiral Particle
            • Multi Spiral Particle
            • Full Spiral Particle
          • Targeted Particle
          • Sphere Particle
          • Text Particle
            • Animated Text Particle
          • Particles
          • Color Format
        • Parkour
        • Condition
        • Preset
        • Sound
        • Message
          • Chat Message
          • Action Bar Message
          • Title Message
        • Lightning
        • Others
    • Presets
    • Mixer
    • Static Effects
  • Colors
    • Adding New Color Scheme
    • Adding New Color Group
  • Configuration
    • General Options
    • Database
    • Permissions
    • GUI Config
      • Item Properties
  • Translations
Powered by GitBook
On this page
  • Description
  • Example
  1. Effects
  2. Creating Effect

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}]
PreviousCreating EffectNextVariables

Last updated 1 year ago