Fabric API

Fabric API

106M Downloads

Attempting to register sprites using SpriteEvent causes NPEs

LemmaEOF opened this issue ยท 3 comments

commented

log of crash here

I'm trying to register sprites using the SpriteEvent, but it causes an NPE crash. Still occurs when putting a break point on SpriteAtlasTexture.reload and on SpriteAtlasTexture.build. Interesting to note: the traceback references at net.minecraft.client.texture.SpriteAtlasTexture.handler$reload$zbn000(SpriteAtlasTexture.java:589), but SpriteAtlasTexture.java only has 268 lines.

Minecraft: 18w50a
Mappings: yarn 18w50a.27
Loader: fabric-loader 0.2.0.64
API: fabric 0.1.1.55

Code being used:

public class InfraRedstoneClient implements ClientModInitializer {
	private SpriteProvider provider;

	@Override
	public void onInitializeClient() {
		SpriteEvent.PROVIDE.register(provider);
		BlockEntityRendererRegistry.INSTANCE.register(DiodeBlockEntity.class, new DiodeRender());
	}
}
class SpriteProvider implements SpriteEvent.Provider {
	@Override
	public void registerSprites(SpriteRegistry registry) {
		registry.register(new Identifier("infraredstone:block/diode_glow"));
	}
}
commented

That line number comes from a mixin.

commented

Ah, yeah, that'd explain it. I'm still not used to mixins with traceback.

commented

Your provider is null.