Custom Blocks

KubeJS TFC allows for the creation of some of TFC’s block types

It also provides a few block entity attachment types


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 0
  • : Set the extended properties of the anvil

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

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
  • : Set the properties of the windmill associated with the axle. Accepts a consumer with the methods
    • .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
    • .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
    • .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, port or face, with a method .port(): boolean which returns if the model is port
    • .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
    • .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, powered or unpowered, with a method .powered(): boolean which returns if the model is powered
    • .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
    • .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

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
    • .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
  • : Create and set the properties of the farmland block associated with the dirt block. Accepts a consumer with the methods
    • .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
  • : Set the properties of the dirt’s mud block. Accepts a consumer with the same methods as the default block builder

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

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
  • : Gives the block the same bounding/hit box as twigs
  • : Set the parent model to kubejs_tfc:block/groundcover/<shape>
  • : Set the block as having collision
  • : Set the block item and clone item of the block to the given item
  • : Set the extended properties of the block

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
    • .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 [0, 15] of the lamp while lit
  • : Set the extended properties of the lamp

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. null is 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’s foilage_fall colormap 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
  • : Set the vertical coordinate, in the range [0, 255] on TFC’s foliage_fall colormap the leaves use for dynamic tinting
  • : Make the dynamic tinting of the leaves change with the seasons
  • : remove all dynamic tinting that is applied to the leaves by default
  • : Set the extended properties of the leaves block

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 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
  • : Set the extended properties of the log block

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
  • : Set the parent models used by the default model generator. Accepts igneous_intrusive, igneous_extrusive, metamorphic, or sedimentary
  • : 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 .count: int field, 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 side and end textures instead of just the end texture

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
    • .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
  • : Set the number of days the sapling needs to grow
  • : Set the number of days the sapling needs to grow via a supplier
  • : Set the tree features of the sapling
    • secondaryChance: number: The chance, in the range [0, 1], that the secondary tree/mega tree/flowers is grown
    • tree: @Nullable ResourceLocation: The id of a configured feature, the basic tree of the sapling
    • secondaryTree: @Nullable ResourceLocation: The id of a configured feature, the secondary tree of the sapling
    • megaTree: @Nullable ResourceLocation: The id of a configured feature, the mega tree of the sapling. For 2 x 2 arrangements of saplings
    • secondaryMegaTree: @Nullable ResourceLocation: The id of a configured feature, the secondary mega tree of the sapling. For 2 x 2 arrangements of saplings
    • flowers: @Nullable ResourceLocation: The id of a configured feature, the tree to place when there are flowers nearby at growth time
    • secondaryFlowers: @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
  • : Set the extended properties of the sapling

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
  • : Set the properties of the horizontal support block. Accepts a consumer with the methods
    • .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

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 [0, 1], the block will drip per tick
  • : Set the temperature (°C) above which the spike will produce drip particles
  • : Set the drip particle options of the spike via the id of a particle type1 or null to indicate the spike does not drip
  • : Set the drip particle options of the spike
  • : Set the model to use for the tip state of the spike
  1. A full list of particle types can be obtained by running the command /kubejs dump_registry minecraft:particle_type in-game. Though do note that not all of them provide a ParticleOptions 

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
    • .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 params
      • lifecycle: Lifecycle: The lifecycle the model is for
      • stage: 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 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 the bush is in for a Month. May be dormant, healthy, flowering, or fruiting
  • : Modify the properties of the product item
  • : Set the product item of the bush to a pre-existing item
  • : Set the model for a given lifecycle and growth stage
  • : Set the model generation for all lifecycles and growth stages via a callback with the params
    • lifecycle: Lifecycle: The lifecycle the model is for
    • stage: 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

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

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
    • flammability: int: How fast the block burns, higher values means a shorter lifetime
    • fireSpreadSpeed: int: How much fire spreads for the block, higher values means more spreading
  • : Set the block to burn like logs
  • : Set the block to burn like planks
  • : Set the block to burn like leaves
  • : Set the block to burn like wool
  • : Set the block’s pathing type, used by mobs to determine if they want to walk over the block or not
  • : Set the block’s enchanting power
  • : Set the block’s enchant power per-block state
  • : Set the block’s clone item (creative mode middle click) to empty
  • : Set the block’s clone item (creative mode middle click). Passing null will make the block the clone stack, which is the default
  • : Set the block as having no collision
  • : Set the block as non-occluding
  • : Set the block’s friction
  • : Set the block’s speed factor
  • : Set the block’s jump factor
  • : Set the sound type of the block
  • : Set the light level of the block per-block state
  • : Set the strength of the block
    • destroyTime: number: The base time it takes to destroy the block
    • explosionResistance: number: The resistance to explosions
  • : Makes the block instabreak, like slime blocks
  • : Sets the strength of the block
  • : Marks the block as randomly ticking
  • : Marks the block as having a dynamic shape
  • : Marks the block as no having any drops
  • : Makes the block use the same loot table as the provided block
  • : Makes the block use the same loot table as the provided block
  • : Marks the block as being air-like
  • : Determines if an entity many spawn on the block
  • : Determines if the block can conduct redstone
  • : Determines if the block is suffocating
  • : Determines if the block is view blocking
  • .hasPostProcess(hasPostProcess: BlockBehaviour$StatePredicate)
    : Determines if the block has post processing during world generation
  • : Determines if the block has emissive rendering
  • : Set the block as requiring the correct tool for it drop items
  • : Set the map color of the block
  • : Set the map color of the block per-block state
  • : Set the map color of the block based on a dye color
  • : Set the block’s destroy time
  • : Set the block’s explosion resistance
  • : Marks the block as being able to be ignited by lava
  • : Marks the block as being a liquid
  • : Forces the block to be solid (?)
  • : Forces the block to be non-solid (?)
  • : Set the block’s reaction to being pushed by pistons
  • : Set the block’s hitbox offset type
  • : Mark the block as requiring the given feature flags to be obtainable/usable in-game
  • : Set the note block instrument of the block
  • : Set the block’s instrument as harp
  • : Mark the block as being 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. Required
  • height: int: An integer number, how tall the container is. Identical to the height of KubeJS’s default inventory. Required
  • inputFilter?: ItemPredicate: An item predicate, what items may enter the container. Identical to the input filter of KubeJS’s default inventory. Optional
  • sizeFilter?: Predicate<Size>: A size predicate, a filter on the size of items that can enter the container. Optional
  • weightFilter?: 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. Required
  • height: int: An integer number, how tall the container is. Identical to the height of KubeJS’s default inventory. Required
  • inputFilter?: ItemPredicate: An item predicate, what items may enter the container. Identical to the input filter of KubeJS’s default inventory. Optional
  • sizeFilter?: Predicate<Size>: A size predicate, a filter on the size of items that can enter the container. Optional
  • weightFilter?: Predicate<Weight>: A weight predicate, a filter on the size of items that can enter the container. Optional
  • trait: 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. Required
  • onlyHeatIfHigher?: boolean: If the internal temperature should only be set if the provided temperature is higher than the current temperature. Optional, defaults to true

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()
        })
})