Use vanilla stitcher for simple atlases
Fixes some minor mod compatibility issues
This commit is contained in:
parent
97e2a318f3
commit
2915a88465
|
|
@ -41,10 +41,16 @@ public class StitcherMixin {
|
|||
*/
|
||||
@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> holderList = new ObjectArrayList<>(this.texturesToBeStitched);
|
||||
holderList.sort(HOLDER_COMPARATOR);
|
||||
|
|
@ -69,7 +75,7 @@ public class StitcherMixin {
|
|||
*/
|
||||
@Inject(method = "gatherSprites", at = @At("HEAD"), cancellable = true)
|
||||
private void gatherSpritesFast(Stitcher.SpriteLoader spriteLoader, CallbackInfo ci) {
|
||||
if(!ModernFixPlatformHooks.INSTANCE.isLoadingNormally())
|
||||
if(this.loadableSpriteInfos == null)
|
||||
return;
|
||||
ci.cancel();
|
||||
for(StbStitcher.LoadableSpriteInfo info : loadableSpriteInfos) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user