Jump to content

I can't understand the way to fix an error in my mod


Walydes

Recommended Posts

Been trying to start making mods and come with an issue after registering a new modded entity. On the launch the game shows an error

java.lang.NullPointerException: Registry Object not present

I'm modding on 1.16.5 forge with geckolib for anumations and custom models. I understand the issue is because of some register entity errors but I can't figure it out completely

 

My ModEntityTypes class is

public class ModEntityTypes { private static java.util.function.Supplier<? extends EntityType<WolfPupEntity>> Supplier;

public static DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, WalydesMod.MOD_ID);

public static final RegistryObject<EntityType<WolfPupEntity>> WOLFPUP = ENTITY_TYPES.register("wolfpup", () -> EntityType.Builder.create(WolfPupEntity::new, EntityClassification.CREATURE)

.size(0.8F, 0.8F) .build(new ResourceLocation(WalydesMod.MOD_ID, "wolfpup").toString()));

public static void register(IEventBus eventBus) { ENTITY_TYPES.register(eventBus); } }

 

And main class registering look like this

 

public WalydesMod() {

IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();

ModItems.register(eventBus);

ModBlocks.register(eventBus);

ModEntityTypes.register(eventBus); register(eventBus);

eventBus.addListener(this::setup); // Register the enqueueIMC method for modloading

eventBus.addListener(this::enqueueIMC); // Register the processIMC method for modloading

eventBus.addListener(this::processIMC); // Register the doClientStuff method for modloading

eventBus.addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in

GeckoLib.initialize();

MinecraftForge.EVENT_BUS.register(this);

RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.WOLFPUP.get(), WolfPupRenderer::new); }

Edited by Walydes
Link to comment
Share on other sites

  • Walydes changed the title to I can't understand the way to fix an error in my mod
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.