2323import java .util .stream .Stream ;
2424
2525public record StitchedTextures (Map <String , TextureAtlasSprite > sprites , Supplier <NativeImage > stitched , int width , int height ) {
26+ // Not sure if 16384 should be the max supported texture size, but it seems to work well enough.
27+ // Max supported texture size seems to mostly be a driver thing, to not let the stitched texture get too big for uploading it to the GPU
28+ // This is not an issue for us
29+ private static final int MAX_TEXTURE_SIZE = 1 << 14 ;
2630
2731 public Optional <TextureAtlasSprite > getSprite (String key ) {
2832 if (TextureSlotsAccessor .invokeIsTextureReference (key )) {
@@ -48,8 +52,7 @@ public static StitchedTextures stitchModelTextures(TextureSlots textures, PackCo
4852
4953 private static SpriteLoader .Preparations prepareStitching (Stream <ResourceLocation > textures , PackContext context ) {
5054 // Atlas ID doesn't matter much here, but BLOCKS is the most appropriate
51- // Not sure if 1024 should be the max supported texture size, but it seems to work
52- SpriteLoader spriteLoader = new SpriteLoader (AtlasIds .BLOCKS , 1024 , 16 , 16 );
55+ SpriteLoader spriteLoader = new SpriteLoader (AtlasIds .BLOCKS , MAX_TEXTURE_SIZE , 16 , 16 );
5356 List <SpriteContents > sprites = textures .distinct ()
5457 .map (texture -> readSpriteContents (texture , context ))
5558 .<SpriteContents >mapMulti (Optional ::ifPresent )
0 commit comments