Posted October 29, 20223 yr 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; } );
October 29, 20223 yr Author Btw, what should I be sending to EntityType.Builder#build(String pId), don't know what that ID is for. This is the link to the repo: https://github.com/AylanJ123/lightning-mobs
October 29, 20223 yr You are not setting the position for the lightning bolt entity. It is probably spawning at 0,0,0 Look at ServerLevel.tickChunk() for how vanilla does it. I assume you are spawning it on the server? See https://forge.gemwire.uk/wiki/Making_Entities for how to define the attributes for your entity and other things. The parameter passed to build() is used by DFU (datafixerupper) So it's pretty much irrelevant unless Mojang somehow know about your Entity and want to apply a fix to its persistent data. 🙂 Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
October 29, 20223 yr Author 59 minutes ago, warjort said: You are not setting the position for the lightning bolt entity. It is probably spawning at 0,0,0 Look at ServerLevel.tickChunk() for how vanilla does it. I assume you are spawning it on the server? See https://forge.gemwire.uk/wiki/Making_Entities for how to define the attributes for your entity and other things. The parameter passed to build() is used by DFU (datafixerupper) So it's pretty much irrelevant unless Mojang somehow know about your Entity and want to apply a fix to its persistent data. 🙂 Oh wow ok, but sending null to that last one was causing me a crash 😧 thanks a lot i'll test all of that
October 29, 20223 yr Author 2 hours ago, warjort said: You are not setting the position for the lightning bolt entity. It is probably spawning at 0,0,0 Look at ServerLevel.tickChunk() for how vanilla does it. I assume you are spawning it on the server? See https://forge.gemwire.uk/wiki/Making_Entities for how to define the attributes for your entity and other things. The parameter passed to build() is used by DFU (datafixerupper) So it's pretty much irrelevant unless Mojang somehow know about your Entity and want to apply a fix to its persistent data. 🙂 Ok now it crashed because entityrenderer is null, I expected it because I don't know what files I could need to make a model for a lightning, or how to grab vanilla one.
October 30, 20223 yr Don't paraphrase errors. Show the full error message preferably by posting a link to the run/logs/debug.log Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
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.