Lightning Procedure not working.

Published by Dragma2005 on Sun, 05/13/2018 - 13:53
Status
Works as designed
Type
Product/platform
Not applicable
Priority
Normal
Issue description

I'm trying to create something that strikes lightning around you using a procedure, but it causes a gradle error. Here it is:

C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_mjolnirLightningProcedure.java:39: error: constructor EntityLightningBolt in class EntityLightningBolt cannot be applied to given types;
            Entity entityToSpawn = new EntityLightningBolt(world);
                                   ^
  required: World,double,double,double,boolean
  found: World
  reason: actual and formal argument lists differ in length
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_mjolnirLightningProcedure.java:46: error: constructor EntityLightningBolt in class EntityLightningBolt cannot be applied to given types;
            Entity entityToSpawn = new EntityLightningBolt(world);
                                   ^
  required: World,double,double,double,boolean
  found: World
  reason: actual and formal argument lists differ in length
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_mjolnirLightningProcedure.java:53: error: constructor EntityLightningBolt in class EntityLightningBolt cannot be applied to given types;
            Entity entityToSpawn = new EntityLightningBolt(world);
                                   ^
  required: World,double,double,double,boolean
  found: World
  reason: actual and formal argument lists differ in length
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_mjolnirLightningProcedure.java:60: error: constructor EntityLightningBolt in class EntityLightningBolt cannot be applied to given types;
            Entity entityToSpawn = new EntityLightningBolt(world);
                                   ^
  required: World,double,double,double,boolean
  found: World
  reason: actual and formal argument lists differ in length
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_mjolnirLightningProcedure.java:67: error: constructor EntityLightningBolt in class EntityLightningBolt cannot be applied to given types;
            Entity entityToSpawn = new EntityLightningBolt(world);
                                   ^
  required: World,double,double,double,boolean
  found: World
  reason: actual and formal argument lists differ in length
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_mjolnirLightningProcedure.java:74: error: constructor EntityLightningBolt in class EntityLightningBolt cannot be applied to given types;
            Entity entityToSpawn = new EntityLightningBolt(world);
                                   ^
  required: World,double,double,double,boolean
  found: World
  reason: actual and formal argument lists differ in length
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_mjolnirLightningProcedure.java:81: error: constructor EntityLightningBolt in class EntityLightningBolt cannot be applied to given types;
            Entity entityToSpawn = new EntityLightningBolt(world);
                                   ^
  required: World,double,double,double,boolean
  found: World
  reason: actual and formal argument lists differ in length
C:\Pylo\MCreator179\forge\build\sources\main\java\mod\mcreator\mcreator_mjolnirLightningProcedure.java:88: error: constructor EntityLightningBolt in class EntityLightningBolt cannot be applied to given types;
            Entity entityToSpawn = new EntityLightningBolt(world);
                                   ^
  required: World,double,double,double,boolean
  found: World
  reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
8 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
 

 

 

This is also the code for it (I saw it said something about an error in there too, so I decided to include it).

package mod.mcreator;

import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraft.world.World;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.Entity;

import java.util.Random;
import java.util.HashMap;

public class mcreator_mjolnirLightningProcedure {

    public static void executeProcedure(java.util.HashMap<String, Object> dependencies) {
        if (dependencies.get("x") == null) {
            System.err.println("Failed to load dependency x for procedure mjolnirLightningProcedure!");
            return;
        }
        if (dependencies.get("y") == null) {
            System.err.println("Failed to load dependency y for procedure mjolnirLightningProcedure!");
            return;
        }
        if (dependencies.get("z") == null) {
            System.err.println("Failed to load dependency z for procedure mjolnirLightningProcedure!");
            return;
        }
        if (dependencies.get("world") == null) {
            System.err.println("Failed to load dependency world for procedure mjolnirLightningProcedure!");
            return;
        }
        int x = (int) dependencies.get("x");
        int y = (int) dependencies.get("y");
        int z = (int) dependencies.get("z");
        World world = (World) dependencies.get("world");
        if (!world.isRemote) {
            Entity entityToSpawn = new EntityLightningBolt(world);
            if (entityToSpawn != null) {
                entityToSpawn.setLocationAndAngles((x + 6), (y + 1), z, world.rand.nextFloat() * 360F, 0.0F);
                world.spawnEntity(entityToSpawn);
            }
        }
        if (!world.isRemote) {
            Entity entityToSpawn = new EntityLightningBolt(world);
            if (entityToSpawn != null) {
                entityToSpawn.setLocationAndAngles((x + 0), (y + 1), (z + 6), world.rand.nextFloat() * 360F, 0.0F);
                world.spawnEntity(entityToSpawn);
            }
        }
        if (!world.isRemote) {
            Entity entityToSpawn = new EntityLightningBolt(world);
            if (entityToSpawn != null) {
                entityToSpawn.setLocationAndAngles((x + -6), (y + 1), (z + 0), world.rand.nextFloat() * 360F, 0.0F);
                world.spawnEntity(entityToSpawn);
            }
        }
        if (!world.isRemote) {
            Entity entityToSpawn = new EntityLightningBolt(world);
            if (entityToSpawn != null) {
                entityToSpawn.setLocationAndAngles((x + 0), (y + 1), (z + -6), world.rand.nextFloat() * 360F, 0.0F);
                world.spawnEntity(entityToSpawn);
            }
        }
        if (!world.isRemote) {
            Entity entityToSpawn = new EntityLightningBolt(world);
            if (entityToSpawn != null) {
                entityToSpawn.setLocationAndAngles((x + 7), (y + 1), z, world.rand.nextFloat() * 360F, 0.0F);
                world.spawnEntity(entityToSpawn);
            }
        }
        if (!world.isRemote) {
            Entity entityToSpawn = new EntityLightningBolt(world);
            if (entityToSpawn != null) {
                entityToSpawn.setLocationAndAngles((x + 0), (y + 1), (z + 7), world.rand.nextFloat() * 360F, 0.0F);
                world.spawnEntity(entityToSpawn);
            }
        }
        if (!world.isRemote) {
            Entity entityToSpawn = new EntityLightningBolt(world);
            if (entityToSpawn != null) {
                entityToSpawn.setLocationAndAngles((x + -7), (y + 1), (z + 0), world.rand.nextFloat() * 360F, 0.0F);
                world.spawnEntity(entityToSpawn);
            }
        }
        if (!world.isRemote) {
            Entity entityToSpawn = new EntityLightningBolt(world);
            if (entityToSpawn != null) {
                entityToSpawn.setLocationAndAngles((x + 0), (y + 1), (z + -7), world.rand.nextFloat() * 360F, 0.0F);
                world.spawnEntity(entityToSpawn);
            }
        }
    }

    public static Object instance;

    public void load(FMLInitializationEvent event) {
    }

    public void generateNether(World world, Random random, int chunkX, int chunkZ) {
    }

    public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
    }

    public void serverLoad(FMLServerStartingEvent event) {
    }

    public void preInit(FMLPreInitializationEvent event) {
    }

    public void registerRenderers() {
    }

    public int addFuel(ItemStack fuel) {
        return 0;
    }
}

 

 

 

Help is appreciated!

Issue comments

To spawn the lightning, use spawn lightning in World management block instead. This way is not supported.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.