Custom Blocks
KubeJS TFC allows for the creation of some of TFC’s block types
-
Anvil –
tfc:anvil -
Aqueduct –
tfc:aqueduct -
Axle –
tfc:axle -
Dirt –
tfc:dirt -
Encased Axle –
tfc:encased-axle -
Groundcover –
tfc:groundcover -
Lamp –
tfc:lamp -
Leaves –
tfc:leaves -
Log –
tfc:log -
Loose Rock –
tfc:loose_rock -
Raw Rock –
tfc:raw_rock -
Rock Spike –
tfc:rock_spike -
Sapling –
tfc:sapling -
Support –
tfc:support -
Thin Spike –
tfc:thin_spike -
Spreading Berry Bush –
tfc:spreading_berry_bush -
Stationary Berry Bush –
tfc:stationary_berry_bush -
Moss Growing Block –
tfc:moss_growing_block -
Moss Growing Slab –
tfc:moss_growing_slab -
Moss Growing Stair –
tfc:moss_growing_stair -
Moss Growing Wall –
tfc:moss_growing_wall -
Moss Spreading Block –
tfc:moss_spreading_block -
Moss Spreading Slab –
tfc:moss_spreading_slab -
Moss Spreading Stair –
tfc:moss_spreading_stair -
Moss Spreading Wall –
tfc:moss_spreading_wall
It also provides a few block entity attachment types
- Inventory –
tfc:inventory - Sealable Inventory –
tfc:sealable_inventory - Heat Consumer –
tfc:heat_consumer - Calendar Tracking –
tfc:calendar_tracking
Anvil
Type: tfc:anvil
Creates a new anvil block
Inherits the methods of the default block builder
Extra Method
: Set the tier of recipes the anvil can perform. Defaults to.tier(tier: int)0
: Set the extended properties of the anvil.extendedProperties(properties: Consumer<ExtendedProperties>)
Example
StartupEvents.registry('block', event => {
event.create('anvil', 'tfc:anvil')
.tier(9)
.texture('tfc:block/metal/smooth/gold')
})
Aqueduct
Type: tfc:aqueduct
Creates a new aqueduct block
Inherits the methods of the default block builder
Extra Methods
: Set the model generation of the aqueduct. Accepts a callback with two parameters, the second being a model generator and the first having the methods.models(models: BiConsumer<AqueductModelPart, ModelGenerator>).base(): boolean: If the model part is the base part.north(): boolean: If the model part is the north part.south(): boolean: If the model part is the south part.east(): boolean: If the model part is the east part.west(): boolean: If the model part is the west part
: Set the fluids the aqueduct may contain.allowedFluids(fluids: ResourceLocation[])
Example
StartupEvents.registry('block', event => {
event.create('aqueduct', 'tfc:aqueduct')
.allowedFluids([
'minecraft:water'
'minecraft:lava'
'kubejs:spring'
'tfc:salt_water'
'tfc:spring_water'
])
})
Axle
Type: tfc:axle
Creates a new axle block and, optionally, related blocks dependent upon it
Inherits the methods of the default block builder
Extra Methods
: Set the texture of the axle.axleTexture(texture: ResourceLocation)
: Set the properties of the windmill associated with the axle. Accepts a consumer with the methods.windmill(windmill: Consumer<WindmillBlockBuilder>).extendedProperties(extendedProperties: Consumer<ExtendedProperties>): Set the extended properties of the windmill- All those of the default block builder
: Create and set the properties of the water wheel associated with the axle. Accepts a consumer with the methods.waterWheel(waterWheel: Consumer<WaterWheelBlockBuilder>).wheelTexture(texture: ResourceLocation): Set the texture used by the water wheel in-world, the given path will be relative to/textures/entity/water_wheel/.rawWheelTexture(texture: ResourceLocation): Set the texture used by the water wheel in-world, the given path will be relative to/textures/.extendedProperties(extendedProperties: Consumer<ExtendedProperties>): Set the extended properties of the water wheel- All those of the default block builder
: Create and set the properties of the gear box associated with the axle. Accepts a consumer with the methods.gearBox(gearBox: Consumer<GearBoxBlockBuilder>).models(models: BiConsumer<GearBoxModelType, ModelGenerator>): Set the model generation of the gear box. Accepts a callback with two parameters, the second being a model generator and the first being an object,portorface, with a method.port(): booleanwhich returns if the model isport.extendedProperties(extendedProperties: Consumer<ExtendedProperties>): Set the extended properties of the gear box- All those of the default block builder
: Create and set the properties of the clutch associated with the axle. Accepts a consumer with the methods.clutch(clutch: Consumer<ClutchBlockBuilder>).models(models: BiConsumer<ClutchModelType, ModelGenerator>): Set the model generation of the clutch. Accepts a callback with two parameters the second being a model generator and the first being an object,poweredorunpowered, with a method.powered(): booleanwhich returns if the model ispowered.extendedProperties(extendedProperties: Consumer<ExtenededProperties>): Set the extended properties of the clutch- All those of the default block builder
: Create and set the properties of the bladed axle associated with the axle. Accepts a consumer with the methods.bladedAxle(bladed: Consumer<BladedAxleBlockBuilder>).extendedProperties(extendedProperties: Consumer<ExtendedProperties>): Set the extended properties of the bladed axle- All those of the default block builder
: Set the extended properties of the axle.extendedProperties(extendedProperties: Consumer<ExtendedProperties>)
Example
StartupEvents.registry('block', event => {
event.create('axle', 'tfc:axle')
.axleTexture('tfc:block/metal/smooth/bronze')
.waterWheel(wheel => {
wheel.rawWheelTexture('tfc:block/metal/smooth/red_steel')
wheel.extendedProperties(props => {
props.noOcclusion().instabreak()
})
})
.clutch(clutch => {
clutch.models((type, m) => {
if (type.powered()) m.parent('minecraft:block/redstone_block')
})
})
})
Dirt
Type: tfc:dirt
Creates a new TFC dirt block
Inherits the methods of the default block builder
Extra Methods
: Set the properties of the dirt’s grass block. Accepts a consumer with the methods.grass(grass: Consumer<ConnectedGrassBlockBuilder>).models(models: BiConsumer<GrassModelPart, ModelGenerator>): Set the model generation of the grass block. Accepts a callback with two arguments, the second being a model generator and the first being an object with four accessible fields.snowy: boolean: If the model is for a snowy state.side: boolean: If the model is for the side of the grass block.top: boolean: If the model is for the top of the grass block.bottom: boolean: If the model is for the bottom of the grass block
- All those of the default block builder
: Create and set the properties of the path block associated with the dirt block. Accepts a consumer with the same methods as the base block builder.path(path: Consumer<TFCPathBlockBuilder>)
: Create and set the properties of the farmland block associated with the dirt block. Accepts a consumer with the methods.farmland(farmland: Consumer<TFCFarmlandBlockBuilder>).extendedProperties(extendedProperties: Consumer<ExtendedProperties>): Set the extended properties of the farmland block- All those of the default block builder
: Set the properties of the dirt’s rooted dirt block. Accepts a consumer with the same methods as the default block builder.rooted(rooted: Consumer<TFCRootedDirtBlockBuilder>)
: Set the properties of the dirt’s mud block. Accepts a consumer with the same methods as the default block builder.mud(mud: Consumer<BlockBuilder>)
Example
StartupEvents.registry('block', event => {
event.create('dirt', 'tfc:dirt')
.texture('tfc:block/charcoal_pile')
.grass(grass => {
grass.texture('tfc:block/wood/planks/oak')
})
})
Encased Axle
Type: tfc:encased-axle
Creates a new encased axle block
Inherits the methods of the default block builder
Extra Method
: Set the extended-properties of the encased axle.extendedProperties(extendedProperties: Consumer<ExtendedProperties>)
Example
StartupEvents.registry('block', event => {
event.create('encased', 'tfc:encased-axle')
.extendedProperties(props => {
props.flammableLikePlanks()
})
})
Groundcover
Type: tfc:groundcover
Creates a new groundcover block
Inherits the methods of the default block builder
Extra Methods
: Gives the block the same bounding/hit box as ore pieces.ore()
: Gives the block the same bounding/hit box as twigs.twig()
: Set the parent model to.groundcoverModelShape(shape: String)kubejs_tfc:block/groundcover/<shape>
: Set the block as having collision.collision()
: Set the block item and clone item of the block to the given item.withPreexistingItem(item: Holder<Item>)
: Set the extended properties of the block.extendedProperties(extendedProperties: Consumer<ExtendedProperties>)
Example
StartupEvents.registry('block', event => {
event.create('groundcover', 'tfc:groundcover')
.groundcoverModelShape('bone')
.withPreexistingItem('bones:bone_spear')
})
Lamp
Type: tfc:lamp
Creates a new lamp block
Inherits the methods of the default block builder
Extra Methods
: Set the model generation of the lamp. Accepts a callback with two parameters, the second being a model generator and the first having two fields.models(models: BiConsumer<LampModelType, ModelGenerator>).on: boolean: If the model is for an lit state.hanging: boolean: If the model is for a hanging state
: Set the light level, in the range.lightLevel(light: int)[0, 15]of the lamp while lit
: Set the extended properties of the lamp.extendedProperties(extendedProperties: Consumer<ExtendedProperties>)
Example
StartupEvents.registry('block', event => {
event.create('lamp', 'tfc:lamp')
.texture('particle', 'minecraft:block/chain')
.texture('metal', 'tfc:block/metal/smooth/steel')
.texture('chain', 'minecraft:block/chain')
.models((type, m) => {
if (type.hanging) m.parent('kubejs:block/hanging_lamp')
})
.lightLevel(7)
})
Leaves
Type: tfc:leaves
Creates a new TFC leaf block
Inherits the methods of the default block builder
Extra Methods
: Set the properties of the fallen leaves associated with the leaves..fallenLeaves(fallenLeaves: @Nullable Consumer<FallenleavesBlockBuidler>)nullis accepted to have to fallen leaves. Accepts a consumer with the following methods.models(models: BiConsumer<FallenLeavesModelType, ModelGenerator>): Set the model generation of the fallen leaves block. Accepts a callback with two parameters, the second being a model generator and the first having the following fields.layers: int: How many layers the model is for, in the range[1, 8].parentModel: ResourceLocation: The default parent model for the model
.autumnIndex(index: int): Set the vertical coordinate, in the range[0, 255], on TFC’sfoilage_fallcolormap the fallen leaves use for dynamic tinting.seasonalColors(): Make the dynamic tinting of the fallen leaves change with the seasons.noDynamicTinting(): Remove all dynamic tinting that is applied to the fallen leaves by default.extendedProperties(extendedProperties: Consumer<ExtendedProperties>): Set the extended properties of the fallen leaves- All those of the default block builder
: Set the twig block to place when the leaves are broken.twig(twig: Holder<Block>)
: Set the vertical coordinate, in the range.autumnIndex(index: int)[0, 255]on TFC’sfoliage_fallcolormap the leaves use for dynamic tinting
: Make the dynamic tinting of the leaves change with the seasons.seasonalColors()
: remove all dynamic tinting that is applied to the leaves by default.noDynamicTinting()
: Set the extended properties of the leaves block.extendedProperties(extendedProperties: Consumer<ExtendedProperties>)
Example
StartupEvents.registry('block', event => {
event.create('leaves', 'tfc:leaves')
.twig('minecraft:cobblestone')
.autumnIndex(29)
.texture('minecraft:block/oak_leaves')
.fallenLeaves(fallen => {
fallen.texture('minecraft:block/spruce_leaves')
fallen.noDynamicTinting()
})
})
Log
Type: tfc:log
Creates a new log block
Inherits the methods of the default block builder
Extra Methods
: Set the properties of the the log’s stripped variant, or remove the stripped variant by passing.stripped(builder: @Nullable Consumer<LogBlockBuilder>)null. Accepts a consumer with the following methods.useFullBlockForItemModel(): Set the item model generation to parent from the block model.extendedProperties(extendedProperties: Consumer<ExtendedProperties>): Set the extended properties of the stripped log- All those of the default block builder
: Set the item model generation to parent from the block model.useFullBlockForItemModel()
: Set the extended properties of the log block.extendedProperties(extendedProperties: Consumer<ExtendedProperties>)
Example
StartupEvents.registry('block', event => {
event.create('log', 'tfc:log')
.stripped(null)
.extendedProperties(props => {
props.flammableLikeLogs()
})
})
Loose Rock
Type: tfc:loose_rock
Creates a new loose rock block
Inherits the methods of the default block builder
Extra Methods
: Makes the block have collision.collision()
: Set the parent models used by the default model generator. Accepts.rockCategory(category: String)igneous_intrusive,igneous_extrusive,metamorphic, orsedimentary
: Set the model generation of the block. Accepts a callback with two parameters, the second being a model generator and the first being an object with a.models(models: BiConsumer<PebbleCount, ModelGenerator>).count: intfield, the number of pebbles that state represents
Example
StartupEvents.registry('block', event => {
event.create('loose_rock', 'tfc:loose_rock')
.rockCategory('sedimentary')
.collision()
})
Raw Rock
Type: tfc:raw_rock
Creates a new raw rock block
Inherits the methods of the default block builder
Extra Method
: Makes the default model generation use the.uniqueSideTexture()sideandendtextures instead of just theendtexture
Example
StartupEvents.registry('block', event => {
event.create('raw_rock', 'tfc:raw_rock')
.uniqueSideTexture()
.stoneSoundType()
})
Rock Spike
Type: tfc:rock_spike
Creates a new rock spike block
Inherits the methods of the default block builder
Extra Methods
: Set the model generation of the rock spike. Accepts a callback with two parameters, the second being a model generator and the first having the methods.models(models: BiConsumer<SpikeModelType, ModelGenerator>).base(): boolean: If the model is for the base state.middle(): boolean: If the model is for the middle state.tip(): boolean: If the model is for the tip state
Example
StartupEvents.registry('block', event => {
event.create('rock_spike', 'tfc:rock_spike')
.models((type, m) => {
if (type.base()) m.parent('minecraft:block/honey_block')
})
})
Sapling
Type: tfc:sapling
Creates a new sapling block
Inherits the methods of the default block builder
Extra Methods
: Allows the sapling to be placed on sand.placeableOnSand()
: Set the number of days the sapling needs to grow.growthDays(days: int)
: Set the number of days the sapling needs to grow via a supplier.growthDaysSupplier(days: Supplier<int>)
: Set the tree features of the sapling.trees(secondaryChance: number, tree: @Nullable ResourceLocation, secondaryTree: @Nullable ResourceLocation, megaTree: @Nullable ResourceLocation, secondaryMegaTree: @Nullable ResourceLocation, flowers: @Nullable ResourceLocation, secondaryFlowers: @Nullable ResourceLocation)secondaryChance: number: The chance, in the range[0, 1], that the secondary tree/mega tree/flowers is growntree: @Nullable ResourceLocation: The id of a configured feature, the basic tree of the saplingsecondaryTree: @Nullable ResourceLocation: The id of a configured feature, the secondary tree of the saplingmegaTree: @Nullable ResourceLocation: The id of a configured feature, the mega tree of the sapling. For 2 x 2 arrangements of saplingssecondaryMegaTree: @Nullable ResourceLocation: The id of a configured feature, the secondary mega tree of the sapling. For 2 x 2 arrangements of saplingsflowers: @Nullable ResourceLocation: The id of a configured feature, the tree to place when there are flowers nearby at growth timesecondaryFlowers: @Nullable ResourceLocation: The id of a configured feature, the secondary tree to place when there are flowers nearby at growth time
: Set the tree of the sapling, accepts the id of a configured feature.tree(tree: ResourceLocation)
: Set the extended properties of the sapling.extendedProperties(extendedProperties: Consumer<ExtendedProperties>)
Example
StartupEvents.registry('block', event => {
event.create('coral_sapling', 'tfc:sapling')
.placeableOnSand()
.tree('tfc:coral_mushroom')
})
Support
Type: tfc:support
Creates a new support block
Inherits the methods of the default block builder
Extra Methods
: Set the model to use for sideways connections.connectionModel(model: ResourceLocation)
: Set the properties of the horizontal support block. Accepts a consumer with the methods.horizontal(horizontalSupport: Consumer<HorizontalSupportBlockBuilder>).extendedProperties(extendedProperties: Consumer<ExtendedProperties>): Set the extended properties of the horizontal support- All those of the default block builder
: Set the extended properties of the support.extendedProperties(extendedProperties: Consumer<ExtendedProperties>)
Example
StartupEvents.registry('block', event => {
event.create('support', 'tfc:support')
.connectionModel('kubejs:block/metal_connection')
.extendedProperties(props => props.flammableLikeLogs())
.horizontal(horizontal => {
horizontal.extendedProperties(props => props.flammableLikePlanks())
})
})
Thin Spike
Type: tfc:thin_spike
Creates a new thin spike block
Inherits the methods of default block builder
Extra Methods
: Set the chance, in the range.dripChance(chance: number)[0, 1], the block will drip per tick
: Set the temperature (°C) above which the spike will produce drip particles.dripTemperature(temperature: number)
: Set the drip particle options of the spike via the id of a particle type1 or.dripParticle(particle: @Nullable Holder<ParticleType<?>>)nullto indicate the spike does not drip
: Set the drip particle options of the spike.fullDripParticle(particle: Supplier<ParticleOptions>)
: Set the model to use for the tip state of the spike.tipModel(model: ResourceLocation)
-
A full list of particle types can be obtained by running the command
/kubejs dump_registry minecraft:particle_typein-game. Though do note that not all of them provide aParticleOptions↩
Example
StartupEvents.registry('block', event => {
event.create('thin_spike', 'tfc:thin_spike')
.dripChance(0.2)
.dripTemperature(12)
.dripParticle('minecraft:falling_spore_blossom')
})
Spreading Berry Bush
Type: tfc:spreading_berry_bush
Creates a new spreading berry bush block
Inherits the methods of the stationary berry bush builder
Extra Methods
: Set the properties of the cane bush block. Accepts a consumer with the methods.cane(cane: Consumer<SpreadingCaneBlockBuilder>).model(lifecycle: Lifecycle, stage: int, modelGenerator: Consumer<ModelGenerator>): Set the model for a given lifecycle and growth stage.models(models: TriConsumer<Lifecycle, int, ModelGenerator>): Set the model generation for all lifecycle and growth stages via a callback with the paramslifecycle: Lifecycle: The lifecycle the model is forstage: int: The growth stage the model is for, in the range[0, 2]model: ModelGenerator: The model generator for the lifecycle & stage
- All those of the default block builder
: Set the max height the bush can grow to be, defaults to.maxHeight(height: int)3
Example
StartupEvents.registry('block', event => {
event.create('spreading_berry_bush', 'tfc:spreading_berry_bush')
.maxHeight(5)
.cane(cane => {
cane.texture('minecraft:block/red_concrete_powder')
})
})
Stationary Berry Bush
Type: tfc:stationary_berry_bush
Creates a new stationary berry bush block
Inherits the methods of the default block builder
Extra Methods
: Set the.lifecycle(month: Month, lifecycle: Lifecycle)Lifecyclethe bush is in for aMonth. May bedormant,healthy,flowering, orfruiting
: Modify the properties of the product item.productItem(productItem: Consumer<itemBuilder>)
: Set the product item of the bush to a pre-existing item.withProduct(product: Holder<Item>)
: Set the model for a given lifecycle and growth stage.model(lifecycle: Lifecycle, stage: int, modelGenerator: Consumer<ModelGenreator>)
: Set the model generation for all lifecycles and growth stages via a callback with the params.models(models: TriConsumer<Lifecycle, int, ModelGenerator>)lifecycle: Lifecycle: The lifecycle the model is forstage: int: The growth stage of the bush, in the range[0, 2]model: ModelGenerator: The model generator for the lifecycle & stage
: Set the extended properties of the bush.extendedProperties(extendedProperties: Consumer<ExtendedProperties>)
Example
StartupEvents.registry('block', event => {
event.create('stationary_berry_bush', 'tfc:stationary_berry_bush')
.lifecycle('january', 'healthy')
.lifecycle('june', 'fruiting')
.withProduct('minecraft:golden_apple')
.models((lifecycle, stage, m) => {
})
})
Moss Growing Block
Type: tfc:moss_growing_block
Creates a new moss growing block
Inherits the methods of the default block builder
Extra Method
: Set the block the moss growing block converts into when moss grows to it.mossyBlock(block: Holder<Block>)
Example
StartupEvents.registry('block', event => {
event.create('moss_growing_block', 'tfc:moss_growing_block')
.mossyBlock('minecraft:mossy_cobblestone')
})
Moss Growing Slab
Type: tfc:moss_growing_slab
Creates a new moss growing
Inherits the methods of the moss growing block builder
Example
StartupEvents.registry('block', event => {
event.create('moss_growing_slab', 'tfc:moss_growing_slab')
.mossyBlock('minecraft:spruce_slab')
})
Moss Growing Stair
Type: tfc:moss_growing_stair
Creates a new moss growing stair
Inherits the methods of the moss growing block builder
Example
StartupEvents.registry('block', event => {
event.create('moss_growing_stair', 'tfc:moss_growing_stair')
.mossyBlock('kubejs:moss_stairs')
})
Moss Growing Wall
Type: tfc:moss_growing_wall
Creates a new moss growing wall block
Inherits the methods of the moss growing block builder
Example
StartupEvents.registry('block', event => {
event.create('moss_growing_wall', 'tfc:moss_growing_wall')
.mossyBlock('minecraft:red_nether_brick_wall')
})
Moss Spreading Block
Type: tfc:moss_spreading_block
Creates a new moss spreading block
Inherits the methods of the default block builder
Example
StartupEvents.registry('block', event => {
event.create('moss_spreading_block', 'tfc:moss_spreading_block')
.texture('kubejs:block/mossy_skulk')
})
Moss Spreading Slab
Type: tfc:moss_spreading_slab
Creates a new moss spreading slab
Inherits the methods of the default block builder
Example
StartupEvents.registry('block', event => {
event.create('moss_spreading_slab', 'tfc:moss_spreading_slab')
.texture('minecraft:block/mossy_stone_bricks')
})
Moss Spreading Stair
Type: tfc:moss_spreading_stair
Creates a new moss spreading stair block
Inherits the methods of the default block builder
Example
StartupEvents.registry('block', event => {
event.create('moss_spreading_stair', 'tfc:moss_spreading_stair')
.texture('minecraft:block/smooth_red_sandstone')
})
Moss Spreading Wall
Type: tfc:moss_spreading_wall
Creates a new moss spreading wall block
Inherits the methods of the default block builder
Example
StartupEvents.registry('block', event => {
event.create('moss_spreading_wall', 'tfc:moss_spreading_wall')
.texture('minecraft:block/lime_concrete')
})
Extended Properties
Some of TFC’s blocks have extended properties which offer greater definition of their behavior. builders for such blocks have a method that takes a consumer with the following methods
: Set the block’s burning properties.flammable(flammability: int, fireSpreadSpeed: int)flammability: int: How fast the block burns, higher values means a shorter lifetimefireSpreadSpeed: int: How much fire spreads for the block, higher values means more spreading
: Set the block to burn like logs.flammableLikeLogs()
: Set the block to burn like planks.flammableLikePlanks()
: Set the block to burn like leaves.flammableLikeLeaves()
: Set the block to burn like wool.flammableLikeWool()
: Set the block’s pathing type, used by mobs to determine if they want to walk over the block or not.pathType(type: PathType)
: Set the block’s enchanting power.enchantPower(power: number)
: Set the block’s enchant power per-block state.enchantPower(powerGetter: Function<BlockState, number>)
: Set the block’s clone item (creative mode middle click) to empty.cloneEmpty()
: Set the block’s clone item (creative mode middle click). Passing.cloneItem(cloneItemStack: @Nullable Item)nullwill make the block the clone stack, which is the default
: Set the block as having no collision.noCollission()
: Set the block as non-occluding.noOcclusion()
: Set the block’s friction.friction(friction: number)
: Set the block’s speed factor.speedFactor(speedFactor: number)
: Set the block’s jump factor.jumpFactor(jumpFactor: number)
: Set the sound type of the block.sound(sound: SoundType)
: Set the light level of the block per-block state.lightLevel(lightLevel: Function<BlockState, int>)
: Set the strength of the block.strength(destroyTime: number, explosionResistance: number)destroyTime: number: The base time it takes to destroy the blockexplosionResistance: number: The resistance to explosions
: Makes the block instabreak, like slime blocks.instabreak()
: Sets the strength of the block.strength(strength: number)
: Marks the block as randomly ticking.randomTicks()
: Marks the block as having a dynamic shape.dynamicShape()
: Marks the block as no having any drops.noLootTable()
: Makes the block use the same loot table as the provided block.dropsLike(block: Block)
: Makes the block use the same loot table as the provided block.dropsLike(block: Supplier<Block>)
: Marks the block as being air-like.air()
: Determines if an entity many spawn on the block.isValidSpawn(isValidSpawn: BlockBehaviour$StateArgumentPredicate<EntityType<?>>)
: Determines if the block can conduct redstone.isRedstoneConductor(isRedstoneConductor: BlockBehaviour$StatePredicate)
: Determines if the block is suffocating.isSuffocating(isSuffocating: BlockBehaviour$StatePredicate)
: Determines if the block is view blocking.isViewBlocking(isViewBlocking: BlockBehaviour$StatePredicate)
: Determines if the block has post processing during world generation.hasPostProcess(hasPostProcess: BlockBehaviour$StatePredicate)
: Determines if the block has emissive rendering.emissiveRendering(emissiveRendering: BlockBehaviour$StatePredicate)
: Set the block as requiring the correct tool for it drop items.requiresCorrectToolsForDrops()
: Set the map color of the block.mapColor(color: MapColor)
: Set the map color of the block per-block state.mapColor(mapColor: Function<BlockState, MapColor>)
: Set the map color of the block based on a dye color.mapColor(color: DyeColor)
: Set the block’s destroy time.destroyTime(destroyTime: number)
: Set the block’s explosion resistance.explosionResistance(explosionResistance: number)
: Marks the block as being able to be ignited by lava.ignitedByLava()
: Marks the block as being a liquid.liquid()
: Forces the block to be solid (?).forceSolidOn()
: Forces the block to be non-solid (?).forceSolidOff()
: Set the block’s reaction to being pushed by pistons.pushReaction(reaction: PushReaction)
: Set the block’s hitbox offset type.offsetType(type: BlockBehaviour$OffsetType)
: Mark the block as requiring the given feature flags to be obtainable/usable in-game.requiredFeatures(flags...: FeatureFlag[])
: Set the note block instrument of the block.instrument(instrument: NoteBlockInstrument)
: Set the block’s instrument as.defaultInstrument()harp
: Mark the block as being replaceable.replaceable()
Inventory
Type: tfc:inventory
An inventory attachment type that can have its contents restricted based on TFC’s size and weight values
Definition
width: int: An integer number, how wide the container is. Identical to the width of KubeJS’s default inventory. Requiredheight: int: An integer number, how tall the container is. Identical to the height of KubeJS’s default inventory. RequiredinputFilter?: ItemPredicate: An item predicate, what items may enter the container. Identical to the input filter of KubeJS’s default inventory. OptionalsizeFilter?: Predicate<Size>: A size predicate, a filter on the size of items that can enter the container. OptionalweightFilter?: Predicate<Weight>: A weight predicate, a filter on the size of items that can enter the container. Optional
This attachment type has all the same methods as the base inventory attachment
Example
StartupEvents.registry('block', event => {
event.create('inventory')
.blockEntity(be => {
be.attach('inv', 'tfc:inventory', [], {
width: 9,
height: 1,
sizeFilter: size => size.isSmallerThan('normal')
})
be.rightClickOpensInventory('inv')
})
})
Sealable Inventory
Type: tfc:sealable_inventory
A TFC inventory attachment that can be sealed to apply a food trait to its contents
Definition
width: int: An integer number, how wide the container is. Identical to the width of KubeJS’s default inventory. Requiredheight: int: An integer number, how tall the container is. Identical to the height of KubeJS’s default inventory. RequiredinputFilter?: ItemPredicate: An item predicate, what items may enter the container. Identical to the input filter of KubeJS’s default inventory. OptionalsizeFilter?: Predicate<Size>: A size predicate, a filter on the size of items that can enter the container. OptionalweightFilter?: Predicate<Weight>: A weight predicate, a filter on the size of items that can enter the container. Optionaltrait: Holder<FoodTrait>: The trait to apply to items while the inventory is sealed. Required
Extra Methods
This attachment type has all the same methods as the base inventory attachment and
.seal(): void: Seals the inventory, preventing modification of its contents.unseal(): void: Unseals the inventory, allowing modification of its contents.toggleSeal(): boolean: Toggles the sealed state of the inventory and returns if the inventory is sealed after toggling.isSealed(): boolean: If the inventory is currently sealed
Example
StartupEvents.registry('block', event => {
event.create('sealable_inventory')
.blockEntity(be => {
be.attach('inv', 'tfc:sealable_inventory', [], {
width: 9,
height: 1,
trait: 'kubejs:trait'
})
})
.rightClick(e => {
let { player } = e
let { inv } = e.block.entity.attachments
if (!player.shiftKeyDown) {
player.openInventoryGUI(inv, event.block.blockState.block.name)
} else {
inv.toggleSeal()
}
})
})
Heat Consumer
Type: tfc:heat_consumer
An IHeatConsumer attachment which exposes TFC’s tfc:heat block capability. Will accept heat from heated device blocks, like the charcoal forge, below it and provide it to the first inventory attachment also present on the block
Definition
decayAmount: number: How much the temperature should decrease (°C) per tick. RequiredonlyHeatIfHigher?: boolean: If the internal temperature should only be set if the provided temperature is higher than the current temperature. Optional, defaults totrue
Methods
.getTemperature(): number: Get the current temperature.setTemperature(temperature: number): void: Set the current temperature
Example
StartupEvents.registry('block', event => {
event.create('heat_consumer')
.blockEntity(be => {
be.attach('heat', 'tfc:heat_consumer', [], {
decayAmount: 0.1
})
be.inventory('inv', [], 9, 1) // For simple demonstration of the application of heat to inventories
be.rightClickOpensInventory('inv')
})
.tag('tfc:charcoal_forge_invisible') // Required for charcoal forges to not extinguish when the blcok is placed above them
})
Calendar Tracking
Type: tfc:calendar_tracking
An attachment which stores a timestamp
Methods
.set(): void: Set the stored timestamp to now.set(tick: int): void: Set the stored timestamp to the given timestamp.get(): int: Get the currently stored timestamp.reset(): void: Set the stored timestamp to-1, a notionally un-set value
Example
StartupEvents.registry('block', event => {
event.create('calendar_tracking')
.blockEntity(be => {
be.attach('cal', 'tfc:calendar_tracking', [], {})
})
.rightClick(e => {
e.block.entity.attachments['cal'].set()
})
})