@@ -407,9 +407,12 @@ export class MinecraftFont {
407407 return Math . max ( width , 0 )
408408 }
409409
410- getColorMaterial ( color : tinycolor . Instance ) : THREE . Material {
411- const colorString = color . toHex8String ( )
412- let material = this . materialCache . get ( colorString )
410+ getColorMaterial (
411+ color : tinycolor . Instance ,
412+ minecraftVersion = Project . animated_java . target_minecraft_version
413+ ) : THREE . Material {
414+ const cacheKey = color . toHex8String ( ) + ';' + minecraftVersion
415+ let material = this . materialCache . get ( cacheKey )
413416 if ( ! material ) {
414417 const alpha = color . getAlpha ( )
415418 if ( alpha < 1 ) {
@@ -421,7 +424,7 @@ export class MinecraftFont {
421424 } else {
422425 material = new THREE . MeshBasicMaterial ( { color : color . toHexString ( ) } )
423426 }
424- this . materialCache . set ( colorString , material )
427+ this . materialCache . set ( cacheKey , material )
425428 }
426429 return material
427430 }
@@ -571,7 +574,11 @@ export class MinecraftFont {
571574 return { mesh, hitbox : backgroundGeo , outline }
572575 }
573576
574- async getCharGeo ( char : string , style : TextComponentStyle ) : Promise < CachedCharGeo > {
577+ async getCharGeo (
578+ char : string ,
579+ style : TextComponentStyle ,
580+ minecraftVersion = Project . animated_java . target_minecraft_version
581+ ) : Promise < CachedCharGeo > {
575582 let font : MinecraftFont = this
576583 if ( style . font ) {
577584 const newFont = await MinecraftFont . getById ( style . font )
@@ -580,12 +587,12 @@ export class MinecraftFont {
580587
581588 const hash = createHash ( 'sha256' )
582589 hash . update ( char )
590+ hash . update ( ';' + minecraftVersion )
583591 hash . update ( ';' + font . id )
584- if ( style . bold ) hash . update ( 'bold' )
585- if ( style . italic ) hash . update ( 'italic' )
586- if ( style . underlined ) hash . update ( 'underlined' )
587- if ( style . strikethrough ) hash . update ( 'strikethrough' )
588- if ( style . font ) hash . update ( ';' + font . id )
592+ if ( style . bold ) hash . update ( ';bold' )
593+ if ( style . italic ) hash . update ( ';italic' )
594+ if ( style . underlined ) hash . update ( ';underlined' )
595+ if ( style . strikethrough ) hash . update ( ';strikethrough' )
589596 const digest = hash . digest ( 'hex' )
590597
591598 const charData = font . getChar ( char )
0 commit comments