stewbeet.plugins.resource_pack.check_power_of_2
The check_power_of_2 plugin validates that all textures in the resource pack have power-of-2 dimensions.
This validation helps ensure optimal performance and compatibility with Minecraft's texture system.
(This plugin requires textures to be already processed and added to the resource pack.)
Features Showcase
Warning messages:
Source Code: stewbeet/plugins/resource_pack/check_power_of_2/__init__.py
What it does
- Validates texture dimensions for power-of-2 compliance (2x2, 4x4, 8x8, 16x16, etc.)
- Warns about non-compliant textures that may cause performance issues
- Checks both item and block textures in the resource pack
- Excludes animation textures and GUI elements with valid aspect ratios
- Helps maintain texture optimization standards
Dependencies
- β
Required: Resource pack textures (from previous plugins like
resource_pack.item_models) - π Position: Can run at any position but after textures are added to the project
(seebasic/beet.ymlfor an example)
Configuration
Basic Example Configuration
yaml
pipeline:
- ...
- "stewbeet.plugins.resource_pack.check_power_of_2"
- ...Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
| No configuration options | - | - | This plugin runs without any configuration parameters |
Features
Power-of-2 Validation
- π Checks texture dimensions using binary bit counting (
bin(dimension).count("1") == 1) - β Validates that width and height are powers of 2 (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024...)
- π― Focuses on item and block textures using pattern matching (
*item/*,*block/*)
Smart Filtering
- π± Excludes animation textures (where height is divisible by width and not square)
- πΌοΈ Skips GUI textures and valid rectangular sprites
- π Only flags problematic square textures or invalid aspect ratios
- β‘ Reduces false positives for intentional non-square textures
Warning System
- π Generates detailed warning messages for non-compliant textures
- π Shows exact file paths and dimensions for easy identification
- π Lists all problematic textures in a single report
Note: This plugin provides validation benefits rather than direct code implementation for performance optimization.
Next steps
- Defining items and blocks: the textures and models this plugin consumes.
- All plugins: the rest of the pipeline, in the order it runs.
- Configuring the build: enabling, ordering and configuring plugins.