Refined Storage

Refined Storage

77M Downloads

Look into fixing Pattern item rendering

Raidobw2 opened this issue ยท 2 comments

commented

Issue description:

Some of the ProjectRed Integration item icons when rendered by a refined storage pattern seem to crash the game.
Modpack: FTB OceanBlock 1.3.0.

What happens:

Game crashes due to a scala match error.

What you expected to happen:

No crash.

Steps to reproduce:

Using a refined storage pattern grid, make a pattern of a ProjectRed Integration Timer and make the item icon appear such as by holding shift or putting the pattern into a crafter.

Version (make sure you are on the latest version before reporting):

  • Minecraft: 1.16.5
  • Forge: Forge 36.2.8
  • Refined Storage: refinedstorage-1.9.15.jar (latest as of right now)

Does this issue occur on a server? [yes/no]
no, render error.

If a (crash)log is relevant for this issue, link it here:

https://paste.feed-the-beast.com/view/d31fd56e
Had the user remove Optifine after the first crash, that file is the definitive one without Optifine.

Additional info

Here a quick link to the line that crashed after pressing Shift to see the item in the pattern:
https://github.com/MrTJP/ProjectRed/blob/e222759924530a83c808642384bf525eb319652d/src/integration/scala/mrtjp/projectred/integration/GateItemRenderer.scala#L36
Please let me know if that's on your side or on Project Red Integration's side. Close without notice in that case, and let me know in the closing message. I won't be making an issue on Project Red Integration's tracker until then, since the error shows: scala.MatchError: pattern (of class com.refinedmods.refinedstorage.item.PatternItem) which leads me to believe perhaps PRI could not predict that com.refinedmods.refinedstorage.item.PatternItem was going to be matched in that function, hence me coming here instead.

commented

Bug in project red. It assumes everything that will render it is a gate item

commented

Yes, correct. ProjectRed makes this assumption. This is a valid assumption to make.

The model is a TESR model which requires access to the ItemStack. Your pattern model is simply returning the wrapped item's model (see here). This is incorrect and breaks all contracts the ItemRenderer system gives, namely that the item being rendered is bound to the Model, this is how the system was designed.

The proper way to handle this is to make your Pattern item a proper TESR model which hands off to ItemRenderer properly to render the wrapped item. I imagine this would also probably fix other cases where TESR item models are used.

We could add some handling PR side to prevent a crash, and probably will. However, that will never resolve the issue of the Item failing to render, the user will simply see nothing.