Skip to content

Commit

Permalink
add jsdoc for correct-texture-dimensions rule
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAfroOfDoom committed Jan 8, 2024
1 parent 7106efa commit 5c129ac
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions package-scripts/linting-rules/correct-texture-dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ const sizeOf = require('image-size');
const name = 'correct-image-dimensions';
const applicableExtensions = ['.png'];

const correctImageDimensions = (file) => {
/**
* If a texture's dimensions aren't minimum powers of 16, Minecraft outputs a warning
* on resourcepack reload (F3 + T) relating to its mip level being limited.
* e.g.: `Texture animated_java:item/black with size 1x1 limits mip level from 4 to 0`
*/
const correctTextureDimensions = (file) => {
// Return early if file does not match any applicable extension
if (applicableExtensions.every((extension) => !file.endsWith(extension))) {
return [];
Expand All @@ -24,6 +29,6 @@ const correctImageDimensions = (file) => {
};

module.exports = {
function: correctImageDimensions,
function: correctTextureDimensions,
name,
};

0 comments on commit 5c129ac

Please sign in to comment.