โฐ stewbeet.plugins.finalyze.custom_blocks_ticking
๐ Source Code: stewbeet/plugins/finalyze/custom_blocks_ticking/__init__.py ๐
๐ Dependencies
- โ
Required: Custom block functions in the
custom_blocks/folder - ๐ง Optional: Custom blocks with
block_name/tick.mcfunctionorblock_name/second.mcfunctionfiles - ๐ Related: Works with
datapack.custom_blocksplugin for block infrastructure
๐ Overview
The finalyze.custom_blocks_ticking plugin automatically sets up ticking functionality
for custom blocks by detecting timing functions in the custom_blocks folder.
It generates the necessary infrastructure to call these functions efficiently, including
entity tagging, scoreboard optimization, and proper integration with versioned functions.
Supports multiple timing intervals: tick, tick_2, second, second_5, and minute.
Some Features Showcase
Automatically links custom blocks timing functions efficiently:

๐ฏ Purpose
- โฐ Automatically detects custom block timing functions (tick, tick_2, second, second_5, minute)
- ๐ท๏ธ Sets up entity tagging system for ticking custom blocks
- ๐ Implements scoreboard-based performance optimization
- ๐ Integrates with versioned function system for proper timing
- โก Provides efficient execution only when ticking entities exist
- ๐ Adds statistics tracking for ticking entities
โ๏ธ Configuration
๐ฏ Basic Example Configuration
pipeline: - ... - stewbeet.plugins.datapack.custom_blocks # Optional if you are adding custom blocks functions yourself - ... - stewbeet.plugins.finalyze.custom_blocks_ticking - ... # No specific configuration required - automatically detects timing functions # Create timing functions in custom_blocks folder: # custom_blocks/{block_name}/tick.mcfunction - Runs every tick (20 times/second) # custom_blocks/{block_name}/tick_2.mcfunction - Runs every 2 ticks (10 times/second) # custom_blocks/{block_name}/second.mcfunction - Runs every second # custom_blocks/{block_name}/second_5.mcfunction - Runs every 5 seconds # custom_blocks/{block_name}/minute.mcfunction - Runs every minute
๐ Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
tick.mcfunction | file | Auto-detected | Custom block function that runs every tick (20 times/second) |
tick_2.mcfunction | file | Auto-detected | Custom block function that runs every 2 ticks (10 times/second) |
second.mcfunction | file | Auto-detected | Custom block function that runs every second |
second_5.mcfunction | file | Auto-detected | Custom block function that runs every 5 seconds |
minute.mcfunction | file | Auto-detected | Custom block function that runs every minute (60 seconds) |
| Function Detection | automatic | N/A | Scans custom_blocks/ folder for timing functions |
| Entity Optimization | automatic | Enabled | Uses scoreboards to optimize execution when no entities exist |
โจ Features
๐ Automatic Function Detection
Scans the custom_blocks folder for timing functions:
- ๐ Searches for functions in
{namespace}:custom_blocks/{block}/folder - โก Detects
tick.mcfunctionfor every-tick execution (20 times/second) - โฑ๏ธ Detects
tick_2.mcfunctionfor every 2 ticks execution (10 times/second) - ๐ Detects
second.mcfunctionfor once-per-second execution - โฐ Detects
second_5.mcfunctionfor every 5 seconds execution - โฒ๏ธ Detects
minute.mcfunctionfor every minute execution - ๐ฏ Validates proper folder structure and naming
๐ท๏ธ Entity Tagging System
Sets up proper entity tags for ticking custom blocks:
- ๐ Adds tags during block placement (
place_secondary) - โก Creates
{namespace}.ticktags for tick-based execution - ๐ Creates
{namespace}.tick_2tags for 2-tick intervals - โฐ Creates
{namespace}.secondtags for second-based ticking - โฑ๏ธ Creates
{namespace}.second_5tags for 5-second intervals - โฒ๏ธ Creates
{namespace}.minutetags for minute-based execution - ๐งน Removes tags during block destruction to prevent memory leaks
๐ Performance Optimization
Implements scoreboard-based optimization for efficient execution:
- โก Tracks
#tick_entitiescount for tick functions - ๐ Tracks
#tick_2_entitiescount for 2-tick functions - ๐ข Tracks
#second_entitiescount for second functions - โฑ๏ธ Tracks
#second_5_entitiescount for 5-second functions - โฒ๏ธ Tracks
#minute_entitiescount for minute functions - ๐ฏ Only executes when entities with tags exist
- โ๏ธ Prevents unnecessary function calls when no ticking blocks are present
๐ Versioned Function Integration
Integrates with the versioned function system for proper timing:
- โก Adds to versioned
tickfunction for every-tick execution - ๐ Adds to versioned
tick_2function for 2-tick execution - โฐ Adds to versioned
secondfunction for once-per-second execution - โฑ๏ธ Adds to versioned
second_5function for 5-second execution - โฒ๏ธ Adds to versioned
minutefunction for every-minute execution - ๐ฏ Uses scoreboard checks to optimize performance
- ๐ Proper integration with existing timing infrastructure
๐ Custom Block Function Distribution
Creates centralized distribution functions for multiple custom blocks:
- โก Generates
{namespace}:custom_blocks/tickdistribution function - ๐ Creates
{namespace}:custom_blocks/tick_2distribution function - ๐ฆ Generates
{namespace}:custom_blocks/seconddistribution function - โฑ๏ธ Creates
{namespace}:custom_blocks/second_5distribution function - โฒ๏ธ Generates
{namespace}:custom_blocks/minutedistribution function - ๐ท๏ธ Uses entity tags to route to specific block functions
- ๐ Allows multiple custom blocks to have ticking functionality
๐ Statistics Integration
Adds ticking entity statistics to the stats system:
- ๐ Initializes scoreboard values for statistics
- โก Reports count of entities with tick tags
- ๐ Reports count of entities with tick_2 tags
- ๐ Reports count of entities with second tags
- โฑ๏ธ Reports count of entities with second_5 tags
- โฒ๏ธ Reports count of entities with minute tags
- ๐ฏ Integrates with existing
_stats_custom_blockssystem