1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-15 20:50:29 +00:00

Add check for if item/block registration has failed

If mod loading fails, we'll continue to load colour handlers. As
blocks/items have not been registered, then we'll throw an NPE.

See MinecraftForge/MinecraftForge#5682. Somewhat fixes #168.
This commit is contained in:
SquidDev 2019-04-09 16:32:20 +01:00
parent 9cdbcb4332
commit aa0e1883d1

View File

@ -121,6 +121,12 @@ public final class ClientRegistry
@SubscribeEvent
public static void onItemColours( ColorHandlerEvent.Item event )
{
if( ComputerCraft.Items.disk == null || ComputerCraft.Blocks.turtleNormal == null )
{
ComputerCraft.log.warn( "Block/item registration has failed. Skipping registration of item colours." );
return;
}
event.getItemColors().register(
( stack, layer ) -> layer == 1 ? ((ItemDisk) stack.getItem()).getColour( stack ) : 0xFFFFFF,
ComputerCraft.Items.disk