stewbeet.plugins.check_unused_textures
The check_unused_textures plugin analyzes texture usage in resource packs.
It scans all PNG files in the textures folder, compares them with texture references
in the generated resource pack, and provides warnings for unused texture files
to help optimize resource pack size and identify orphaned assets.
Required: meta.stewbeet.textures_folder configuration
Required: Beet context with resource pack assets
Position: Must run after all texture-generating plugins
Related: Works with any plugins that generate textures
Feature Showcase
Warning message in terminal:
Source Code: stewbeet/plugins/check_unused_textures/__init__.py
What it does
- Identifies unused texture files in the resource pack
- Analyzes texture references across all generated assets
- Provides warnings for orphaned texture files
- Helps optimize resource pack size by finding unused assets
- Generates detailed reports of unused texture paths
- Assists in resource pack cleanup and maintenance
Configuration
Basic Example Configuration
pipeline:
- ...
- stewbeet.plugins.check_unused_textures # Should run after all texture-generating plugins
- ...
meta:
stewbeet:
textures_folder: "assets/textures" # Required: path to textures folderConfiguration Options
| Option | Type | Default | Description |
|---|---|---|---|
textures_folder | string | Required | Path to the folder containing PNG texture files |
| Warning Output | automatic | Enabled | Shows warnings for unused textures in console |
| File Extension | constant | .png | Only PNG files are analyzed for texture usage |
| Path Comparison | automatic | Relative | Compares relative paths from textures folder |
Features
Texture Discovery System
Scans the textures folder for all PNG files:
- π Recursively searches the configured textures folder
- πΌοΈ Identifies all PNG files using glob pattern
*.png - π Calculates relative paths from the textures folder root
- π Builds a texture inventory for analysis
Usage Analysis Engine
Compares texture files with resource pack references:
- π Checks each texture against
ctx.assets.texturescollection - π― Handles both Texture objects and string references
- βοΈ Removes file extensions for accurate path matching
- π Uses
endswith()matching for flexible path comparison
Unused Texture Detection
Identifies orphaned texture files not referenced in the pack:
- π« Detects textures with no matching references in the resource pack
- π Collects unused texture paths in a dedicated set
- π― Supports both direct texture objects and string path references
- β Ensures accurate detection through path matching
Warning Report Generation
Provides detailed warnings for unused textures:
- π Sorts unused texture paths alphabetically for organized output
- π Shows complete file paths relative to textures folder
- β οΈ Generates multi-line warning messages with clear formatting
- π¨ Uses structured warning format for easy identification
Next steps
- Configuring the build: where this plugin sits in the pipeline.
- All plugins: the rest of the pipeline, in the order it runs.
- Configuring the build: enabling, ordering and configuring plugins.