-
Notifications
You must be signed in to change notification settings - Fork 125
[EN] TFG Custom Kubejs Scripts
- 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.
{
"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
}
}
}
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.
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)
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
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.
We have several types of decorative plants.
The basic tfg:decorative_plant
will create a block with typical plant block attributes like random offset, instant break, non placeable on unsupported faces, and smaller box size. By default the builder will automatically make loot tables for harvesting the plant with knives, hoes, and scythes. If you want to replace this item with something else, use the lootItem()
method, which will mean you can only use shears to pick up the 'original' block. It also supports waterlogging with water, sea water, spring water, and mars water. (More fluids can be added via Core)
The tfg:tall_decorative_plant
does the same thing but as an n-block tall plant. Use the height()
method to set the maximum height of the tall block, up to a maximum of 5.
tfg:floating_decorative_plant
inherits from the basic one and is made for plants that float on water, like lily pads. It has a boolean xz_offset()
method (true
by default) that controls whether or not this block should have a random XZ offset, for things like algae.
tfg:attached_decorative_plant
inherits from the basic one and is used for plants that are attached to other blocks, like tfc's artists conk. It will only attach to blocks that have the tfg:decorative_plant_attachable
tag. It also has a allowVertical()
boolean method (false
by default) to allow placements on the top and bottom sides of blocks.
event.create(string name, 'tfg:decorative_plant') // Default box size (3, 0, 3, 13, 7, 13)
event.create(string name, 'tfg:tall_decorative_plant') // Default box size (2, 0, 2, 14, 16, 14)
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:tall_decorative_plant')
.soundType('nether_wart')
.tagItem('tfg:venus_plants')
.lightLevel(0.4)
.renderType('translucent')
.height(3) // 2 by default
})
You will also need to provide a blockstate file for the tall_decorative_plant, like this:
It needs states for ALL of the possible heights from 0 to 4, even if some are unused! Otherwise you get log spam.
{
"variants": {
"height=0": {
"model": "tfg:block/test_bottom"
},
"height=1": {
"model": "tfg:block/test_top"
},
"height=2": {
"model": ""
},
"height=3": {
"model": ""
},
"height=4": {
"model": ""
}
}
}
An example of tfg:decorative_plant
.
An example of
tfg:tall_decorative_plant
.
Notes:
- Tall decorative blocks do not currently support cardinal block states.
To help with placing the tall decorative plants, there's a tfg:tall_decorative_plant
configured feature. You can use it like this:
"type": "tfg:tall_decorative_plant",
"config": {
"block": "betterend:lanceleaf",
"plantHeight": 5,
"minHeight": 4,
"maxHeight": 7,
"middle": 2
}
-
block
specifies the block ID to use. This must be atfg:tall_decorative_plant
block. -
plantHeight
is the "normal" height of the plant to use and should be the same as theheight()
method in the block builder. -
minHeight
is the minimum height of the plant that you want to be placed. The smallest this can be isplantHeight - 1
. -
maxHeight
is the maximum height of the plant that can be placed. The placer will randomly pick a number between these two for the height of the plant, inclusive. -
middle
is the block state ID to either repeat (for taller plants) or omit (for shorter plants)
For example, with the above configuration, you'll get plants like [0, 1, 3, 4] or [0, 1, 2, 2, 2, 3, 4].
The placer also handles waterlogging for you.