Daveyx0 / PrimitiveMobs

34 stars 13 forks source link

[Crash] Treasure Slime with Quark Dark Oak Chest causes Client Crash #250

Open noobanidus opened 5 years ago

noobanidus commented 5 years ago

Crash log here: https://paste.dimdev.org/dagofiqapa.mccrash

One of the users on my server is having issues with a treasure slime that they gave a dark oak chest to.

From what I can see in the code, an incorrect assumption is being made that ItemStack::getMetaData is guaranteed to be a valid state in it's ItemBlock's block's blockstate container. I'm surprised this crash doesn't happen more regularly, especially with modded items.

You definitely want to check to make sure that ItemStack::getMetaData is at least < getValidStates().size() at some point in the mix if you're going to be relying on this functionality. You can probably fall back on the standard getItemStackColour utility function.

Either way, there isn't actually any guarantee that the metadata of an ItemBlock has any relevance to its states, at least as far as I'm aware.