Skip to content

[EN] TFG Custom Kubejs Scripts

Redeix edited this page Jul 3, 2025 · 14 revisions

Startup Scripts

Particle Emitter Blocks

There are two methods available for creating particle emitting blocks; tfg:particle_emitter_decoration and tfg:particle_emitter. Creating a particle_emitter_decoration with make a block with properties similar to a grass block--With random offset, smaller box size, canSurvive conditions, etc. Creating a particle_emitter will create a normal minecraft block.

Method

	event.create(string name, 'tfg:particle_emitter_decoration') // or 'tfg:particle_emitter'
		.particleOffset(double x, double y, double z)        // Determines the offset from the block that the particles spawn at. (default: 0.25, 1.0, 0.25)
		.particleVelocity(double x, double y, double z)      // Determines the velocity of the particles. (default: 0.0, 0.07, 0.0)
		.particle(string simpleParticleType)                 // Determines the type of particle
		.dustColor(float r, float g, float b, float scale)   // Optional. If particle type is 'minecraft:dust', assigns color and scale. (float from 0.0 to 1.0)
		.particleCount(int)                                  // Determines the number of particles spawning per tick. (Default: 1)
		.particleForced(boolean)                             // Determines if the particles will be visible from a far distance. (Default: false)

Example

	event.create('tfg:test', 'tfg:particle_emitter_decoration')		
                .particleOffset(0.3, 2, 0.3)                        //x, y, z
		.particleVelocity(0, 0.1, 0)                        //x, y, z
		.particle('minecraft:dust')
		.dustColor(0.0, 1.0, 0.2, 1.5)                      //r, g, b, scale
		.particleCount(6)
		.particleForced(true)

The above example will make a decoration block that spawns green minecraft:dust particles above the block.

particle_emitter_example

Notes:

  • Other kubejs binders still work with this e.g. .tagBlock()
  • Forcing particles will enable them to appear at far distances, but they will not generate if the player is not within range.
  • All binders are optional, the builder method has pre set defaults.
  • Particles in Minecraft behave with their own custom hard-coded physics on a per-particle basis. A particle may not generate as you might expect.
Clone this wiki locally