ποΈ stewbeet.plugins.finalyze.basic_datapack_structure
π Source Code: stewbeet/plugins/finalyze/basic_datapack_structure/__init__.py π
π Dependencies
- β Required: Project ID and version in context
- π§ Optional: Versioned timing functions (tick_2, second, second_5, minute)
- π Related: Works with versioned function system
π Overview
The finalyze.basic_datapack_structure plugin sets up essential timing infrastructure
for Minecraft datapacks by creating timer systems for different intervals. It automatically
detects existing versioned timing functions and generates the necessary tick-based
logic to call them at proper intervals with optimized load distribution.
Feature Showcase
Timer systems for different intervals (tick_2, second, second_5, minute):

π― Purpose
- β° Sets up basic timing infrastructure for datapacks
- π Creates timer systems for different intervals (tick_2, second, second_5, minute)
- π Implements scoreboard-based timing logic
- β‘ Optimizes load distribution with offset timing
- π― Automatically detects existing timing functions
- ποΈ Provides foundation for datapack timing systems
βοΈ Configuration
π― Basic Example Configuration
pipeline: - ... - stewbeet.plugins.finalyze.basic_datapack_structure - ... # No specific configuration required - automatically detects timing functions # Creates timer infrastructure for any existing versioned functions: # {namespace}:v{version}/tick_2 - Every 2 ticks (0.1 seconds) # {namespace}:v{version}/second - Every second # {namespace}:v{version}/second_5 - Every 5 seconds # {namespace}:v{version}/minute - Every minute
π Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
tick_2 | function | Auto-detected | Function called every 2 ticks (0.1 seconds) |
second | function | Auto-detected | Function called every second (20 ticks) |
second_5 | function | Auto-detected | Function called every 5 seconds (100 ticks) |
minute | function | Auto-detected | Function called every minute (1200 ticks) |
| Timer Offset | automatic | Enabled | Offset timing for better load distribution |
β¨ Features
π Automatic Function Detection
Scans for existing versioned timing functions in the datapack:
- π Detects
v{version}/tick_2functions for high-frequency timing - β±οΈ Identifies
v{version}/secondfunctions for per-second execution - π Finds
v{version}/second_5functions for 5-second intervals - β° Locates
v{version}/minutefunctions for minute-based timing
π Timer Reset System
Implements proper timer initialization for each detected function:
- π Resets
#tick_2timer to 1 for immediate first execution - β±οΈ Initializes
#secondtimer to 0 for standard counting - π Sets
#second_5timer to -10 for offset execution - β° Resets
#minutetimer to 1 for proper timing
β‘ Load Distribution Optimization
Uses offset timing to distribute computational load:
- π―
tick_2executes at 3+ ticks instead of 2 for offset - π
second_5starts at -10 to spread load (90+ ticks instead of 100) - β‘ Prevents multiple timers from executing simultaneously
- π Improves server performance by avoiding tick spikes
π’ Scoreboard Timer Logic
Creates efficient scoreboard-based timing system:
- π Increments timer scoreboards each tick
- π―
#tick_2increments for 2-tick timing - β±οΈ
#secondincrements for 20-tick (1 second) timing - π
#second_5increments for 100-tick (5 second) timing - β°
#minuteincrements for 1200-tick (1 minute) timing
π― Conditional Function Execution
Implements threshold-based function calling:
- π Calls
tick_2when score reaches 3+ (offset timing) - β±οΈ Executes
secondwhen score reaches 20+ (1 second) - π Triggers
second_5when score reaches 90+ (offset 5 ticks) - β° Invokes
minutewhen score reaches 1200+ (1 minute)
ποΈ Tick File Integration
Integrates timing logic into the main tick function:
- π Prepends timer logic to existing tick functions
- π§ Ensures timing infrastructure runs before other tick logic
- β‘ Maintains proper execution order for dependent systems
- π― Provides foundation for all datapack timing needs