๐Ÿ” stewbeet.plugins.finalyze.check_unused_textures

๐Ÿ“„ Source Code: stewbeet/plugins/finalyze/check_unused_textures/__init__.py ๐Ÿ”—

๐Ÿ”— Dependencies

  • โœ… 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

๐Ÿ“‹ Overview

The finalyze.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.

Feature Showcase

Warning message in terminal:

๐ŸŽฏ Purpose

  • ๐Ÿ” 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.finalyze.check_unused_textures # Should run after all texture-generating plugins - ... meta: stewbeet: textures_folder: "assets/textures" # Required: path to textures folder

๐Ÿ“‹ Configuration Options

OptionTypeDefaultDescription
textures_folderstringRequiredPath to the folder containing PNG texture files
Warning OutputautomaticEnabledShows warnings for unused textures in console
File Extensionconstant.pngOnly PNG files are analyzed for texture usage
Path ComparisonautomaticRelativeCompares 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 comprehensive texture inventory for analysis

๐Ÿ“Š Usage Analysis Engine

Compares texture files with resource pack references:

  • ๐Ÿ”— Checks each texture against ctx.assets.textures collection
  • ๐ŸŽฏ 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 comprehensive 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