@@ -196,29 +196,19 @@ private static void InteractionBar_AddImprovementButtons(InteractionBar __instan
196196 // }
197197 }
198198
199- [ HarmonyPrefix ]
200- [ HarmonyPatch ( typeof ( MeshCache ) , nameof ( MeshCache . GetOrCreateMaterialPropertyBlock ) ) ]
201- private static bool MeshCache_GetOrCreateMaterialPropertyBlock ( ref MaterialPropertyBlock __result , MeshCache __instance , string atlasName )
199+ [ HarmonyPostfix ]
200+ [ HarmonyPatch ( typeof ( PolytopiaSpriteRenderer ) , nameof ( PolytopiaSpriteRenderer . ForceUpdateMesh ) ) ]
201+ private static void PolytopiaSpriteRenderer_ForceUpdateMesh ( PolytopiaSpriteRenderer __instance )
202202 {
203- MaterialPropertyBlock propertyBlock ;
204- propertyBlock = new MaterialPropertyBlock ( ) ;
205- propertyBlock . SetVector ( "_Flip" , new Vector4 ( 1f , 1f , 0f , 0f ) ) ;
206- if ( string . IsNullOrEmpty ( atlasName ) )
203+ if ( __instance . atlasName != null )
207204 {
208- propertyBlock . SetTexture ( "_MainTex" , ModLoader . sprites [ "fruit_minerskagg_" ] . texture ) ;
209- }
210- else
211- {
212- GameManager . GetSpriteAtlasManager ( ) . LoadSpriteAtlasTexture ( atlasName , ( Il2CppSystem . Action < UnityEngine . Texture2D > ) getAtlasTex ) ;
213- }
214- __result = propertyBlock ;
215- return false ;
216-
217- void getAtlasTex ( Texture2D texture )
218- {
219- if ( texture != null )
205+ if ( string . IsNullOrEmpty ( __instance . atlasName ) )
220206 {
221- propertyBlock . SetTexture ( "_MainTex" , texture ) ;
207+ MaterialPropertyBlock materialPropertyBlock ;
208+ materialPropertyBlock = new MaterialPropertyBlock ( ) ;
209+ materialPropertyBlock . SetVector ( "_Flip" , new Vector4 ( 1f , 1f , 0f , 0f ) ) ;
210+ materialPropertyBlock . SetTexture ( "_MainTex" , __instance . sprite . texture ) ;
211+ __instance . meshRenderer . SetPropertyBlock ( materialPropertyBlock ) ;
222212 }
223213 }
224214 }
0 commit comments