Skip to content

Commit

Permalink
Merge 1.20.4 into 1.20.5
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Apr 24, 2024
2 parents 7ee968f + c8f9b1c commit 3f68814
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ public class StitcherMixin<T extends Stitcher.Entry> {
*/
@Inject(method = "stitch", at = @At("HEAD"), cancellable = true)
private void stitchFast(CallbackInfo ci) {
this.loadableSpriteInfos = null;
if(!ModernFixPlatformHooks.INSTANCE.isLoadingNormally()) {
ModernFix.LOGGER.error("Using vanilla stitcher implementation due to invalid loading state");
return;
}
if(this.texturesToBeStitched.size() < 100) {
// The vanilla implementation is fine for small atlases, and using it allows mods like JEI that depend on
// precise texture alignments to avoid bugs.
return;
}
ci.cancel();
ObjectArrayList<Stitcher.Holder<T>> holderList = new ObjectArrayList<>(this.texturesToBeStitched);
holderList.sort(HOLDER_COMPARATOR);
Expand All @@ -69,7 +75,7 @@ private void stitchFast(CallbackInfo ci) {
*/
@Inject(method = "gatherSprites", at = @At("HEAD"), cancellable = true)
private void gatherSpritesFast(Stitcher.SpriteLoader<T> spriteLoader, CallbackInfo ci) {
if(!ModernFixPlatformHooks.INSTANCE.isLoadingNormally())
if(this.loadableSpriteInfos == null)
return;
ci.cancel();
for(StbStitcher.LoadableSpriteInfo<T> info : loadableSpriteInfos) {
Expand Down

0 comments on commit 3f68814

Please sign in to comment.