question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[1.10.2] Crash when holding shift with a pattern in inventory

See original GitHub issue

… when the pattern’s output is an item that is rendered via CodeChickenLib’s revived IItemHandler.

refinedstorage-1.2.17.jar
CodeChickenLib-1.10.2-2.5.2.203-universal.jar
gregtech-5.10.35-HOMEBAKED.8.jar (my own build, but I didn't touch the item rendering)
forge-1.10.2-12.18.3.2215-universal.jar

You’re gonna love this.

Steps to reproduce:

  1. Program a pattern with a GT cell of some kind as the output.
  2. Hold shift.
  3. Client crash.

Stack trace goes like this:

java.lang.ClassCastException: com.raoulvdberge.refinedstorage.item.ItemPattern cannot be cast to gregtech.api.items.GT_Generic_Item
	at gregtech.common.render.ItemRenderer.renderItem(ItemRenderer.java:300)
	at gregtech.common.render.ItemRenderer$BakedModelItemRendererWrapper.renderItem(ItemRenderer.java:317)
	at codechicken.lib.render.item.CCRenderItem.func_180454_a(CCRenderItem.java:84)
	at codechicken.lib.render.item.CCRenderItem.func_184390_a(CCRenderItem.java:164)
	at codechicken.lib.render.item.CCRenderItem.func_184391_a(CCRenderItem.java:224)
	at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:266)
	at net.minecraft.client.gui.inventory.GuiContainer.func_73863_a(GuiContainer.java:96)
	at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:382)

RefinedStorage isn’t mentioned in the trace except as the item type. But let’s take a closer look. In BakedModelPattern.java, we have an override set whenever a pattern is rendered with the Shift key held down. This shows the pattern’s output instead of the generic pattern icon for the pattern item. This is done by returning whatever IBakedModel is associated with the pattern’s single output. This usually works because IBakedModel doesn’t care about which itemstack is being rendered.

But with CodeChickenLib in play, that IBakedModel isn’t necessarily a model at all! CCL revives the old IItemRenderer which happens to inherit from IBakedModel. And an implementation of IItemRenderer (such as GregTech’s) will of course need the actual item stack to do the rendering. (Stack is passed to renderer here.)

So even though you return the correct IBakedModel for the pattern’s output, that object might actually be an IItemRenderer which will insist on receiving the correct item, where it currently receives a item.ItemPattern instead.

I don’t expect a fix for this. Mostly, I’m posting it to publically document the issue for anyone else trying to use GT and RS together.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
way2muchnoisecommented, Jan 24, 2017

Related to #609. The issue that we can change the actual model being rendered, but not the ItemStack passed along for models using a builtin renderer.

0reactions
Dragon2488commented, Jan 24, 2017

Calls can be caught at the same level CCL and TESR does it. Using it you will be able to safely render itemstack-based and TESR items. The actual question is how long it will took for you to rewrite pattern cell renderer and how difficult is it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pattern Items Not Rendering Models · Issue #609 - GitHub
Models aren't being rendered on the "shift view" for pattern items. TESR related? ... [1.10.2] Crash when holding shift with a pattern in...
Read more >
ATM7 Client crashes when pressing shift when in chest ...
For some odd reason if I press the shift button while viewing any chest inventory my game completely crashes. I have restarted my...
Read more >
[MC-31222] Crash on pressing the inventory close key and an ...
It seems like it's trying to swap items using indexes from the old inventory within the player's inventory. This can further be seen...
Read more >
Direwolf20 FTB Server 1.10.2 - BoardGameGeek
Fixed a crash on 1.10.2 version when picking up a piston. ... Just shift right click an inventory with an empty hand, and...
Read more >
Came crashes when Shift+Clicking? - Legacy Support - Archive
Shift-clicking something into a full chest from inventory or from chest into full inventory crashes the client. It is a known bug, yes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found