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