Skip to content

[EN] TFG Custom Kubejs Scripts

Redeix edited this page Jul 3, 2025 · 7 revisions

Startup Scripts

General Info

  • Other kubejs binders still work with any of these methods e.g. .tagBlock()
  • Unless otherwise stated--All new methods can accept cardinal based block state jsons to allow them to rotate around the y-axis. Example below.

Example of a cardinal block state json. v

{
  "variants": {
    "facing=east": {
      "model": "tfg:block/test",
      "y": 270
    },
    "facing=north": {
      "model": "tfg:block/test",
      "y": 180
    },
    "facing=south": {
      "model": "tfg:block/test"
    },
    "facing=west": {
      "model": "tfg:block/test",
      "y": 90
    }
  }
}



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 range 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

StartupEvents.registry('block', event => {
	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. v particle_emitter_decoration_example Notes:

  • 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.



Decorative Plant Blocks

There are two methods available for decorative plant blocks tfg:decorative_plant and tfg:double_decorative_plant. Decorative_plant will create a block with typical plant block attributes like random offset, instant break, non place able on unsupported faces, and smaller box size. While the double_decorative block does the same thing but as a two-block tall plant. By default the builder will automatically make loot tables for harvesting the plant with knives, hoes, and scythes.

Methods

event.create(string name, 'tfg:decorative_plant')                    // Default box size (3, 0, 3, 13, 7, 13)
event.create(string name, 'tfg:double_decorative_plant')             // Default box size (2, 0, 2, 14, 16, 14)

Examples

StartupEvents.registry('block', event => {
	event.create('tfg:test', 'tfg:decorative_plant')
		.soundType('nether_wart')        
		.tagItem('tfg:venus_plants')
		.box(3, 0, 3, 13, 14, 13)
})
StartupEvents.registry('block', event => {
	event.create('tfg:test', 'tfg:double_decorative_plant')
		.soundType('nether_wart')
		.tagItem('tfg:venus_plants')
		.lightLevel(0.4)
		.renderType('translucent')
})

You will also need to proved a blockstate file for the double_decorative_plant, like this:

{
  "variants": {
    "half=lower": {
      "model": "tfg:block/test_bottom"
    },
    "half=upper": {
      "model": "tfg:block/test_top"
    }
  }
}

An example of tfg:decorative_plant. v decorative_plant_example An example of tfg:double_decorative_plant. v double_decorative_plant_example Notes:

  • Double decorative blocks do not currently support cardinal block states.



Clone this wiki locally