I'm starting with modding and I'm having a hard time spawning a lightning. Don't know if I'm doing something wrong here. I tried with a class extending from LightningBolt first, but can't spawn a vanilla one neither.
public static void SpawnLightning(Level level) {
level.addFreshEntity(EntityType.LIGHTNING_BOLT.create(level));
//level.addFreshEntity(Registry.UNSTABLE_LIGHTNING.get().create(level));
}
Is this supposed to be done differently? Also, my console is getting spammed with
[Render thread/ERROR] [minecraft/Util]: Entity lightningmobs:unstable_lightning has no attributes
Dunno why or how to fix it. This is how I am registering this.
public static final RegistryObject<EntityType<UnstableLightning>> UNSTABLE_LIGHTNING = ENTITIES.register(
"unstable_lightning", (Supplier<? extends EntityType<UnstableLightning>>)
() -> {
EntityType.Builder<UnstableLightning> builder = EntityType.Builder.of(UnstableLightning::new, MobCategory.AMBIENT);
EntityType<UnstableLightning> type = builder.build(new ResourceLocation(LMobs.MODID + ":unstable_lightning").toString());
return type;
}
);