Jump to content

[SOLVED] [1.7.10] Creating entity throws InstantiationException


Recommended Posts

Posted

When I'm trying to spawn entity my server is shutting down and throws this:

> [08:41:38] [Client thread/ERROR] [FML]: A severe problem occurred during the spawning of an entity at ( -260.46875,64.0, 223.84375)

> java.lang.InstantiationException

> at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_60]

> at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_60]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:77) [EntitySpawnHandler.class:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.channelRead0(EntitySpawnHandler.java:34) [EntitySpawnHandler.class:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.channelRead0(EntitySpawnHandler.java:28) [EntitySpawnHandler.class:?]

> at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) [simpleChannelInboundHandler.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

> at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]

> at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]

> at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]

> at cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:77) [FMLProxyPacket.class:?]

> at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) [ej.class:?]

> at net.minecraft.client.multiplayer.PlayerControllerMP.func_78765_e(PlayerControllerMP.java:273) [bje.class:?]

> at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1602) [bao.class:?]

> at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973) [bao.class:?]

> at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898) [bao.class:?]

> at net.minecraft.client.main.Main.main(SourceFile:148) [Main.class:?]

> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]

> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]

> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]

> at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]

> at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

> at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

> [08:41:38] [Client thread/ERROR] [FML]: EntitySpawnHandler exception

> java.lang.RuntimeException: java.lang.InstantiationException

> at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-17.0.jar:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:126) ~[EntitySpawnHandler.class:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.channelRead0(EntitySpawnHandler.java:34) ~[EntitySpawnHandler.class:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.channelRead0(EntitySpawnHandler.java:28) ~[EntitySpawnHandler.class:?]

> at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[simpleChannelInboundHandler.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

> at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]

> at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]

> at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]

> at cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:77) [FMLProxyPacket.class:?]

> at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) [ej.class:?]

> at net.minecraft.client.multiplayer.PlayerControllerMP.func_78765_e(PlayerControllerMP.java:273) [bje.class:?]

> at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1602) [bao.class:?]

> at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973) [bao.class:?]

> at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898) [bao.class:?]

> at net.minecraft.client.main.Main.main(SourceFile:148) [Main.class:?]

> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]

> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]

> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]

> at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]

> at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

> at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

> Caused by: java.lang.InstantiationException

> at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_60]

> at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_60]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:77) ~[EntitySpawnHandler.class:?]

> ... 24 more

> [08:41:38] [Client thread/ERROR] [FML]: OpenGuiHandler exception

> java.lang.RuntimeException: java.lang.InstantiationException

> at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-17.0.jar:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:126) ~[EntitySpawnHandler.class:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.channelRead0(EntitySpawnHandler.java:34) ~[EntitySpawnHandler.class:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.channelRead0(EntitySpawnHandler.java:28) ~[EntitySpawnHandler.class:?]

> at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[simpleChannelInboundHandler.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

> at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]

> at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]

> at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]

> at cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:77) [FMLProxyPacket.class:?]

> at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) [ej.class:?]

> at net.minecraft.client.multiplayer.PlayerControllerMP.func_78765_e(PlayerControllerMP.java:273) [bje.class:?]

> at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1602) [bao.class:?]

> at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973) [bao.class:?]

> at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898) [bao.class:?]

> at net.minecraft.client.main.Main.main(SourceFile:148) [Main.class:?]

> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]

> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]

> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]

> at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]

> at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

> at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

> Caused by: java.lang.InstantiationException

> at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_60]

> at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_60]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:77) ~[EntitySpawnHandler.class:?]

> ... 24 more

> [08:41:38] [Client thread/ERROR] [FML]: HandshakeCompletionHandler exception

> java.lang.RuntimeException: java.lang.InstantiationException

> at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-17.0.jar:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:126) ~[EntitySpawnHandler.class:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.channelRead0(EntitySpawnHandler.java:34) ~[EntitySpawnHandler.class:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.channelRead0(EntitySpawnHandler.java:28) ~[EntitySpawnHandler.class:?]

> at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[simpleChannelInboundHandler.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

> at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]

> at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]

> at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]

> at cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:77) [FMLProxyPacket.class:?]

> at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) [ej.class:?]

> at net.minecraft.client.multiplayer.PlayerControllerMP.func_78765_e(PlayerControllerMP.java:273) [bje.class:?]

> at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1602) [bao.class:?]

> at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973) [bao.class:?]

> at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898) [bao.class:?]

> at net.minecraft.client.main.Main.main(SourceFile:148) [Main.class:?]

> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]

> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]

> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]

> at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]

> at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

> at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

> Caused by: java.lang.InstantiationException

> at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_60]

> at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_60]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:77) ~[EntitySpawnHandler.class:?]

> ... 24 more

> [08:41:38] [Client thread/ERROR] [FML]: There was a critical exception handling a packet on channel FML

> java.lang.RuntimeException: java.lang.InstantiationException

> at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-17.0.jar:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:126) ~[EntitySpawnHandler.class:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.channelRead0(EntitySpawnHandler.java:34) ~[EntitySpawnHandler.class:?]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.channelRead0(EntitySpawnHandler.java:28) ~[EntitySpawnHandler.class:?]

> at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[simpleChannelInboundHandler.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?]

> at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[MessageToMessageDecoder.class:?]

> at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?]

> at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?]

> at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?]

> at cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:77) [FMLProxyPacket.class:?]

> at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) [ej.class:?]

> at net.minecraft.client.multiplayer.PlayerControllerMP.func_78765_e(PlayerControllerMP.java:273) [bje.class:?]

> at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1602) [bao.class:?]

> at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973) [bao.class:?]

> at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898) [bao.class:?]

> at net.minecraft.client.main.Main.main(SourceFile:148) [Main.class:?]

> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]

> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]

> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]

> at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]

> at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

> at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

> Caused by: java.lang.InstantiationException

> at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_60]

> at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_60]

> at cpw.mods.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:77) ~[EntitySpawnHandler.class:?]

> ... 24 more

 

 

My entity class:

public abstract class mEntityFireball extends Entity {

    public EntityLivingBase shootingEntity;

    private int ticksAlive;

 

    public mEntityFireball() {

        super(null);

    }

 

    public mEntityFireball(World world) {

        super(world);

    }

 

    public mEntityFireball(World world, EntityLivingBase entity) {

        super(world);

        this.shootingEntity = entity;

        this.setSize(1.0F, 1.0F);

        this.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);

        this.setPosition(this.posX, this.posY, this.posZ);

        this.yOffset = 0.0F;

        this.motionX = entity.getLookVec().xCoord;

        this.motionY = entity.getLookVec().yCoord;

        this.motionZ = entity.getLookVec().zCoord;

    }

 

    public abstract void onImpact(MovingObjectPosition hit);

 

    public void onUpdate() {

        if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) {

            this.setDead();

        } else {

            super.onUpdate();

 

            if (this.worldObj.getBlock((int) this.posX, (int) this.posY, (int) this.posZ) == Blocks.air) {

                ++this.ticksAlive;

                if (this.ticksAlive == 600) {

                    this.setDead();

                }

                return;

            }

        }

 

        Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);

        Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

        MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31);

        vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);

        vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

 

        if (movingobjectposition != null) {

            vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);

        }

 

        Entity entity = null;

        List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));

        double d0 = 0.0D;

 

        for (int i = 0; i < list.size(); ++i) {

            Entity entity1 = (Entity) list.get(i);

            if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity))) {

                float f = 0.3F;

                AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double) f, (double) f, (double) f);

                MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);

 

                if (movingobjectposition1 != null) {

                    double d1 = vec3.distanceTo(movingobjectposition1.hitVec);

                    if (d1 < d0 || d0 == 0.0D) {

                        entity = entity1;

                        d0 = d1;

                    }

                }

            }

        }

 

        if (entity != null) {

            movingobjectposition = new MovingObjectPosition(entity);

        }

 

        if (movingobjectposition != null) {

            this.onImpact(movingobjectposition);

        }

 

        this.posX += this.motionX;

        this.posY += this.motionY;

        this.posZ += this.motionZ;

        this.rotationYaw = (float) (Math.atan2(this.motionZ, this.motionX) * 180.0D / Math.PI) + 90.0F;

 

        while (this.rotationPitch - this.prevRotationPitch >= 180.0F) {

            this.prevRotationPitch += 360.0F;

        }

 

        while (this.rotationYaw - this.prevRotationYaw < -180.0F) {

            this.prevRotationYaw -= 360.0F;

        }

 

        while (this.rotationYaw - this.prevRotationYaw >= 180.0F) {

            this.prevRotationYaw += 360.0F;

        }

 

        this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;

        this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;

        for (int i = 0; i < 10; i++) {

            this.worldObj.spawnParticle("flame", this.posX + rand.nextDouble() - 0.5, this.posY + rand.nextDouble(), this.posZ + rand.nextDouble() - 0.5, 0.0D, 0.0D, 0.0D);

        }

        this.setPosition(this.posX, this.posY, this.posZ);

    }

 

    public void writeEntityToNBT(NBTTagCompound tag)

    {

        tag.setDouble("posX", this.posX);

        tag.setDouble("posY", this.posY);

        tag.setDouble("posZ", this.posZ);

        tag.setDouble("motionX", this.motionX);

        tag.setDouble("motionY", this.motionY);

        tag.setDouble("motionZ", this.motionZ);

    }

 

    public void readEntityFromNBT(NBTTagCompound tag)

    {

        this.posX = tag.getDouble("posX");

        this.posY = tag.getDouble("posY");

        this.posZ = tag.getDouble("posZ");

        this.motionX = tag.getDouble("motionX");

        this.motionY = tag.getDouble("motionY");

        this.motionZ = tag.getDouble("motionZ");

    }

 

    protected void entityInit() {}

}

 

 

I tried to add constructor without arguments, but this changed nothing. Here's how I'm registering it:

@EventHandler

    public void Init(FMLInitializationEvent event)

    {

        EntityRegistry.registerModEntity(mEntityFireball.class, "mFireball", 1, instance, 80, 1, true);

    }

 

 

 

I added another entity based on EntityCreature and it works good. Where is the problem?

Posted

But how does original minecraft fireball works? It is abstract too

public abstract class EntityFireball extends Entity

and contains

protected abstract void onImpact(MovingObjectPosition p_70227_1_);

Posted

Here's my instantiation:

mEntityFireball fireball = new mEntityFireball(world, entityPlayer) {

                @Override

                protected void onImpact(MovingObjectPosition p1) {

                    if (p1.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) {

                        p1.entityHit.attackEntityFrom(DamageSource.causePlayerDamage(entityPlayer), damage);

                    }

                    setDead();

                }

            };

 

and it works with vanilla EntityFireball

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.