mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-15 12:40:30 +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:
parent
9cdbcb4332
commit
aa0e1883d1
@ -121,6 +121,12 @@ public final class ClientRegistry
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onItemColours( ColorHandlerEvent.Item event )
|
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(
|
event.getItemColors().register(
|
||||||
( stack, layer ) -> layer == 1 ? ((ItemDisk) stack.getItem()).getColour( stack ) : 0xFFFFFF,
|
( stack, layer ) -> layer == 1 ? ((ItemDisk) stack.getItem()).getColour( stack ) : 0xFFFFFF,
|
||||||
ComputerCraft.Items.disk
|
ComputerCraft.Items.disk
|
||||||
|
Loading…
Reference in New Issue
Block a user