Jump to content

Recommended Posts

Posted
public class Haki {
    public static final DeferredRegister<Attribute> REGISTRY = DeferredRegister.create(ForgeRegistries.Keys.ATTRIBUTES,
            Hakimod.MODID);
    public static final RegistryObject<Attribute> ARMAMENT = REGISTRY.register("armament_haki",
            ()-> new RangedAttribute("attribute.hakimod.armament", 0, 0, 200));
    public static final RegistryObject<Attribute> OBSERVATION = REGISTRY.register("observation_haki",
            () -> new RangedAttribute("attribute.hakimod.observation", 0, 0, 200));
    public static final RegistryObject<Attribute> CONQUEROR = REGISTRY.register("conqueror_haki",
            ()-> new RangedAttribute("attribute.hakimod.conqueror", 0, 0, 200));

    @SubscribeEvent
    public static void regAttr(EntityAttributeCreationEvent e){
        e.put(EntityType.PLAYER,
                AttributeSupplier.builder().add(ARMAMENT.get(), 0).build());
        e.put(EntityType.PLAYER,
                AttributeSupplier.builder().add(OBSERVATION.get(), 0).build());
        e.put(EntityType.PLAYER,
                AttributeSupplier.builder().add(CONQUEROR.get(), 0).build());
    }
}

This is my class with the Attributes.

 

And this is how I add them into the bus.

        modEventBus.addListener(Haki::regAttr);
        modEventBus.register(Haki.REGISTRY);

 

I get this error:

net.minecraftforge.fml.ModLoadingException: hakimod (hakimod) encountered an error during the common_setup event phase §7java.lang.NullPointerException: Registry Object not present: hakimod:armament_haki

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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