Fusion (Connected Textures)

Fusion (Connected Textures)

40M Downloads

[Bug] CT data `ModelProperty` provided to FramedBlocks is no longer a valid cache key

XFactHD opened this issue ยท 3 comments

commented

Version Info

  • Minecraft: 1.21.1
  • NeoForge: 21.1.93
  • Fusion: 1.2.2
  • FramedBlocks: 10.2.1

What mod loader are you using?: NeoForge

Are you using OptiFine: No

Description of the Bug
FramedBlocks aggressivly caches generated quads and the cache key includes the CT data extracted from the ModelData provided by the camo model if the ModelProperty of the CT data in question is known to FramedBlocks. In the recently released refactor of Fusion, the ModelProperty provided to FramedBlocks for CT compatibility was changed such that it is no longer compatible with the (currently unwritten, shame on me) API contract of the IMC endpoint being used:

  • It no longer implements equals() and hashCode() (leads to the cache in FramedBlocks being effectively bypassed and slowly leaking memory)
  • It contains data not suitable to be held in a cache, specifically the BlockAndTintGetter (significantly worsens the leak as it leads to the section data copy [or even worse the entire ClientLevel when a framed block is rendered on the main thread such as when FramedBlocks renders the placement preview with a camo applied] being kept around indefinitely)
  • It no longer provides data that uniquely identifies the CT state of the block being rendered (would lead to false cache hits if the first issue was fixed)

Steps to Reproduce

  1. Place a few framed blocks and apply a Fusion-enabled block as the camo
  2. Set a breakpoint in FramedBlockModel#getQuads() and check the size of the FramedBlockModel#quadCache map with the debugger
  3. Reload chunks a few times
  4. Repeat steps 2 and 3 a few times to observe the cache's size increasing uncontrollably