πŸ–ΌοΈ stewbeet.plugins.resource_pack.check_power_of_2

πŸ“„ Source Code: stewbeet/plugins/resource_pack/check_power_of_2/__init__.py πŸ”—

πŸ”— 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
    (see basic/beet.yml for an example)

πŸ“‹ Overview

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:

🎯 Purpose

  • πŸ” 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

βš™οΈ Configuration

🎯 Basic Example Configuration

pipeline: - ... - "stewbeet.plugins.resource_pack.check_power_of_2" - ...

πŸ“‹ Configuration Options

OptionTypeDefaultDescription
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 comprehensive report

Note: This plugin provides validation benefits rather than direct code implementation for performance optimization.