Posted May 23, 201411 yr I have a block that ticks randomly and would like it so it creates lightning and explosions. I have seen several variations of spawn lightning but none of them draw the lightning, only fire appears. Explosions on the other hand, don't happen at all (I only want cosmetic ones) public void updateTick(World world, int x, int y, int z, Random rand) { log.info("Update @ "+x+" "+y+" "+z); if (rand.nextBoolean()) { log.info("Lightning!"); EntityLightningBolt lightning = new EntityLightningBolt(world, x, y+1, z); world.addWeatherEffect(lightning); } else { log.info("Explosion!"); world.spawnParticle("largeexplode", x, y, z, 0.0D, 0.0D, 0.0D); } } The text is being displayed but nothing appears
May 24, 201411 yr I have never used addWeatherEffect, but I have spawned lightining using a different line. instead try: EntityLightningBolt lightning = new EntityLightningBolt(world, x, y+1, z); world.spawnEntityInWorld(lightning); As for the explosions: world.createExplosion(lightning, lightning.posX, lightning.posY, lightning.posZ, <Explosion Strength, Go With A # Around 4>, false); Creator Of Weapons+ Mod & Sword Art Online HUD Mod
May 25, 201411 yr Author The code for spawning in lightning you gave me only created the fire but not the actual lightning. (Tried in rain and not) As for the explosions, I only want the particles and not effects of one
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.