Error for my Custom Projectile

Started by KBEHAN on

Topic category: Advanced modding

Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Error for my Custom Projectile

Hi, Ive made this custom projectile but the error : Entitytornado is not abstract and does not override abstract method onImpact(MovingObjectPosition) in EntityThrowable   public static class Entitytornado extends EntityThrowable implements IProjectile{ .  However I have the method onImpact.  Ive tried putting listener, and @Override. Please help, I am not sure what to do and how to fix this.

Here is my code:

package mod.mcreator;//based on master condiguration
 
import cpw.mods.fml.client.*;
import cpw.mods.fml.client.registry.*;
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.asm.*;
import cpw.mods.fml.common.asm.transformers.*;
import cpw.mods.fml.common.discovery.*;
import cpw.mods.fml.common.discovery.asm.*;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.functions.*;
import cpw.mods.fml.common.network.*;
import cpw.mods.fml.common.registry.*;
import cpw.mods.fml.common.toposort.*;
import cpw.mods.fml.common.versioning.*;
import cpw.mods.fml.relauncher.*;
import cpw.mods.fml.server.*;
import net.minecraft.block.*;
import net.minecraft.block.material.*;
import net.minecraft.client.*;
import net.minecraft.client.audio.*;
import net.minecraft.client.entity.*;
import net.minecraft.client.gui.*;
import net.minecraft.client.gui.achievement.*;
import net.minecraft.client.gui.inventory.*;
import net.minecraft.client.model.*;
import net.minecraft.client.multiplayer.*;
import net.minecraft.client.particle.*;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.culling.*;
import net.minecraft.client.renderer.entity.*;
import net.minecraft.client.renderer.tileentity.*;
import net.minecraft.client.settings.*;
import net.minecraft.command.*;
import net.minecraft.crash.*;
import net.minecraft.creativetab.*;
import net.minecraft.dispenser.*;
import net.minecraft.enchantment.*;
import net.minecraft.entity.*;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.boss.*;
import net.minecraft.entity.effect.*;
import net.minecraft.entity.item.*;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.player.*;
import net.minecraft.entity.projectile.*;
import net.minecraft.inventory.*;
import net.minecraft.item.*;
import net.minecraft.item.crafting.*;
import net.minecraft.nbt.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.*;
import net.minecraft.network.rcon.*;
import net.minecraft.pathfinding.*;
import net.minecraft.potion.*;
import net.minecraft.profiler.*;
import net.minecraft.server.*;
import net.minecraft.server.dedicated.*;
import net.minecraft.server.gui.*;
import net.minecraft.server.integrated.*;
import net.minecraft.server.management.*;
import net.minecraft.src.*;
import net.minecraft.stats.*;
import net.minecraft.tileentity.*;
import net.minecraft.util.*;
import net.minecraft.village.*;
import net.minecraft.world.*;
import net.minecraft.world.biome.*;
import net.minecraft.world.chunk.*;
import net.minecraft.world.chunk.storage.*;
import net.minecraft.world.demo.*;
import net.minecraft.world.gen.*;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.layer.*;
import net.minecraft.world.gen.structure.*;
import net.minecraft.world.storage.*;
import net.minecraftforge.classloading.*;
import net.minecraftforge.client.*;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.sound.*;
import net.minecraftforge.common.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;
import net.minecraftforge.event.entity.item.*;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.minecart.*;
import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.event.terraingen.*;
import net.minecraftforge.event.world.*;
import net.minecraftforge.oredict.*;
import net.minecraftforge.transformers.*;
import net.minecraft.init.*;
import java.util.*;
import java.awt.event.*;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.EntityDamageSourceIndirect;
import net.minecraft.block.material.Material;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
 
 
@SuppressWarnings("unchecked")
public class mcreator_tornado {
 
    public static int mobid = 0;
    public Object instance;
 
    public void load(){}
 
    public void generateNether(World world, Random random, int chunkX, int chunkZ){}
    public void generateSurface(World world, Random random, int chunkX, int chunkZ){}
    public int addFuel(ItemStack fuel){
        return 0;
    }
    @SideOnly(Side.CLIENT)
    public void registerRenderers(){
        RenderingRegistry.registerEntityRenderingHandler(mcreator_tornado.Entitytornado.class, new RenderSnowball(mcreator_airSpell.block));
    }
 
 
    public void serverLoad(FMLServerStartingEvent event){}
    public void preInit(FMLPreInitializationEvent event){
        int entityID = EntityRegistry.findGlobalUniqueEntityId();
        mobid = entityID;
        EntityRegistry.registerGlobalEntityID(mcreator_tornado.Entitytornado.class, "tornado", entityID);
        EntityRegistry.registerModEntity(mcreator_tornado.Entitytornado.class, "tornado", entityID, instance, 64, 1, true);
       
 
       
    }
 
 
  public static class Entitytornado extends EntityThrowable implements IProjectile{

     /** How many ticks the arrow has been in the air. */
    public int inAirTicks;

    Random rand;
 
public Entitytornado(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public Entitytornado(World par1World, EntityLivingBase par2EntityLivingBase)
{
super(par1World, par2EntityLivingBase);
}
 
public Entitytornado(World par1World)
{
super(par1World);
}

@Override
     protected float getGravityVelocity() {
          return 0.0F;
     }

     @Override
     protected float func_70182_d() {
          return 0.75F;
}

@Override
public void onUpdate() {
     

// The code here will work just as well in a TickHandler:
// First get player position and set to local variables, this is the location we want to spawn particles in.
double posX = this.posX - (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
double posY = this.posY;
double posZ = this.posZ - (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
float f = 0.4F;

// If you want, add player's motion to current position, but not necessary
double motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
double motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
double motionY = (double)(-MathHelper.sin((this.rotationPitch + 2.0F) / 180.0F * (float)Math.PI) * f);

// Here's where the magic happens:
this.worldObj.spawnParticle("cloud", posX + motionX, posY + motionY, posZ + motionZ, this.motionX, this.motionY + 0.1D, this.motionZ);
 }
}

    /**
 * Called when this EntityThrowable hits a block or entity.
 */
public void onImpact(MovingObjectPosition par1MovingObjectPosition)
    {
        if (par1MovingObjectPosition.entityHit != null)
        {
            byte b0 = 18;          
 
            par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)b0);
        }
 
        if (!this.worldObj.isRemote)
        {
            this.setDead();
        }
    }
}
    
 

If anyone who knows how to code/java please help.

 

Joined Aug 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try removing import net
Sat, 08/12/2017 - 18:13

Try removing import net.minecraft.crash.*; so it doesn't crash.

No just kidding, I have no idea.

Joined Aug 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How did you make the
Sat, 08/12/2017 - 18:13

How did you make the projectile entity?

Joined Aug 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What does it say in the
Sat, 08/12/2017 - 18:58

What does it say in the console?