Skip to content

Commit

Permalink
fix: don't enable eye layer texture blending issue workaround quirk f…
Browse files Browse the repository at this point in the history
…or 24w40a+

Minecraft has finally fixed the bug I reported by accident, seemingly
while reworking the entity eye rendering to fix unrelated issues. In the
process, another issue reported by an unrelated third-party about eyes
no longer being semitransparent on the affected invisible entities has
appeared, but is duplicated by another issue which was resolved as
"working as intended", so... This is indeed a fix overall?

In either case, it's no longer a reason for PackSquash to do less
optimizations, so I'm happy.

Related: #39
  • Loading branch information
AlexTMjugador committed Nov 20, 2024
1 parent 1b3e54d commit fd9af95
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ Versioning](https://semver.org/spec/v2.0.0.html).
disabled by default until the necessary features to better automatically
determine its default value are implemented, as it caused issues with e.g.
more common than expected single-color font textures.
- Updated OxiPNG, bringing image compression improvements at the cost of
slightly slower execution times.
- The `bad_entity_eye_layer_texture_transparency_blending` quirk is no longer
enabled by default for packs targeting Minecraft 24w40a (1.20.2) or newer, as
the [related bug](https://bugs.mojang.com/browse/MC-235953) has been fixed in
newer versions. (While the bug was technically resolved in 24w39a, that
snapshot shares its resource pack format version with earlier snapshots, so
PackSquash can't distinguish between them.)
- Updated OxiPNG, bringing the image compression improvements made upstream.

#### Distribution

Expand Down
10 changes: 5 additions & 5 deletions packages/packsquash/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,11 @@ pub enum MinecraftQuirk {
/// textures to a palette, which includes color quantization, as it is used to generate
/// a palette. This incurs some space costs.
RestrictiveBannerLayerTextureFormatCheck,
/// All currently known Minecraft versions overlay entity layer textures in a way that
/// does not account for transparency properly, by taking into account their color and
/// not only their transparency values as blending coefficients to use for overlying
/// that texture. PackSquash can change the color of transparent pixels, and as such it
/// can trigger this behavior.
/// All known Minecraft versions before snapshot 24w39a (1.12.2) overlay entity layer
/// textures in a way that does not account for transparency properly, by taking into
/// account their color and not only their transparency values as blending coefficients
/// to use for overlying that texture. PackSquash can change the color of transparent
/// pixels, and as such it can trigger this behavior.
///
/// This workaround stops PackSquash from changing the color of transparent pixels and
/// quantizing the pixels to a palette to reduce texture file size, as both optimizations
Expand Down
7 changes: 4 additions & 3 deletions packages/packsquash/src/pack_file/asset_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ pub enum PackFileAssetType {
/// due to a quirk on how older Minecraft versions (<= 1.12.2) processed them.
BannerLayer,
/// An Enderman, Ender Dragon, Phantom or spider eye layer texture, with `.png` extension.
/// These textures are rendered by the eyes render type, which by default has some problems
/// with alpha blending that are exacerbated with the optimizations PackSquash does. As of
/// 15th November 2021, all released Minecraft versions are affected by these problems.
/// These textures are rendered by the eyes render type, which by default may have some
/// problems with alpha blending that are exacerbated with the optimizations PackSquash does.
/// As of November 20th, 2024, only Minecraft version 24w39a (Minecraft 1.21.2) and newer
/// are not affected by these problems.
EyeLayer,
/// A texture that may be used as an input render target in a shader program via a sampler
/// uniform.
Expand Down
10 changes: 8 additions & 2 deletions packages/packsquash/src/pack_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub const PACK_FORMAT_RESOURCE_PACK_VERSION_1_18: i32 = 8;
/// The resource pack format version used in Minecraft versions from 24w13a (1.20.5 snapshot)
/// to 1.20.5-pre3.
pub const PACK_FORMAT_RESOURCE_PACK_VERSION_24W_13A: i32 = 31;
/// The resource pack format version used in Minecraft version 24w40a (1.21.2 snapshot).
pub const PACK_FORMAT_RESOURCE_PACK_VERSION_24W_40A: i32 = 40;
/// The data pack format version used in Minecraft versions from 24w21a (1.21 snapshot)
/// to 1.21-pre1.
pub const PACK_FORMAT_DATA_PACK_VERSION_24W_21A: i32 = 45;
Expand Down Expand Up @@ -183,8 +185,12 @@ impl PackMeta {
quirks |= MinecraftQuirk::Java8ZipParsing;
}

// All known Minecraft versions are affected by this quirk
quirks |= MinecraftQuirk::BadEntityEyeLayerTextureTransparencyBlending;
if self.pack_format_version < PACK_FORMAT_RESOURCE_PACK_VERSION_24W_40A {
// 24w39a is the first snapshot to have this fixed, but we can't tell it
// apart from 24w38a due to it sharing the same pack format version number,
// so err on the safe side
quirks |= MinecraftQuirk::BadEntityEyeLayerTextureTransparencyBlending;
}

quirks
}
Expand Down

0 comments on commit fd9af95

Please sign in to comment.