Jump to content

[SOLVED] [1.7.10] Creating entity throws InstantiationException


IamMaxim

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I am following a tutorial for modding minecraft 1.20.1, and while running the mod with the minecraft of the idea, no errors was present but, when I switched to real minecraft, it started to want a default constructor "public ZeroToAutomation()" instead of the one recomended by the video "public ZeroToAutomation(FMLJavaModLoadingContext context) {...}", and I can't use the default constructor because I need the FMLJavaModLoadingContext to register the blocks and items.   The problem is at: "net/myself/zerotoautomation/ZeroToAutomation.java" the file contains the default constructor, "Logger"s, and the code for the mod the defaut constructor was added after an error requesting it the Loggers was used to see which methods/constructors was used by the Launcher   things that I tried to fix the issue: remove the default constructor, but an error appeared "net.myself.zerotoautomation.ZeroToAutomation.<init>()", and nothing else on the class runs adding an "public static void init()" method, but it changed nothing   The mod files: https://github.com/Matwaua/Zero_To_Automation/tree/not-finished
    • It is an issue/conflict with distanthorizons
    • I have been trying to combat this issue between oculus and embeddium and to no avail... I have already tried a few online tutorials on how to get this working but it doesn't work at all. https://pastebin.com/geQgifjc
    • wow you sound like fun to play with
    • Instale el mod en mi servidor y este se queda iniciando por horas, en la consola me habla de algo de permisos y trate de seguir la ruta que me da pero no existe.   [13:05:32 INFO]: CustomNPC Permissions available: [13:05:32 INFO]: customnpcs.edit.blocks [13:05:32 INFO]: customnpcs.edit.villager [13:05:32 INFO]: customnpcs.global.bank [13:05:32 INFO]: customnpcs.global.dialog [13:05:32 INFO]: customnpcs.global.faction [13:05:32 INFO]: customnpcs.global.linked [13:05:32 INFO]: customnpcs.global.naturalspawn [13:05:32 INFO]: customnpcs.global.playerdata [13:05:32 INFO]: customnpcs.global.quest [13:05:32 INFO]: customnpcs.global.recipe [13:05:32 INFO]: customnpcs.global.transport [13:05:32 INFO]: customnpcs.npc.advanced [13:05:32 INFO]: customnpcs.npc.ai [13:05:32 INFO]: customnpcs.npc.clone [13:05:32 INFO]: customnpcs.npc.create [13:05:32 INFO]: customnpcs.npc.delete [13:05:32 INFO]: customnpcs.npc.display [13:05:32 INFO]: customnpcs.npc.freeze [13:05:32 INFO]: customnpcs.npc.gui [13:05:32 INFO]: customnpcs.npc.inventory [13:05:32 INFO]: customnpcs.npc.reset [13:05:32 INFO]: customnpcs.npc.stats [13:05:32 INFO]: customnpcs.scenes [13:05:32 INFO]: customnpcs.soulstone.all [13:05:32 INFO]: customnpcs.spawner.create [13:05:32 INFO]: customnpcs.spawner.mob [13:05:32 INFO]: customnpcs.tool.mounter [13:05:32 INFO]: customnpcs.tool.nbtbook [13:05:32 INFO]: customnpcs.tool.pather [13:05:32 INFO]: customnpcs.tool.scripter
  • Topics

×
×
  • Create New...

Important Information

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