Jump to content

[1.9]EntityThrowable bug


FLUFFY2

Recommended Posts

I have made a custom throwable entity which causes damage if it hits a living entities.

Now sometimes the custom entity dosen't even fly away, just straight causes damage to the thrower itself.

Mostly happends when you are really close to another living entity.

 

You can try this with snowballs too, if you walk pass or close to a zombie, than you go like 2-3 blocks away, the snowball will most likely explode in fornt of you, and never cause knockback on the zombie.

 

This must be some bug with the EntityThrowable class's onUpdate method because only this part is revalent to the actual entity raytrace part:

Entity entity = null;
        List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expandXyz(1.0D));
        double d0 = 0.0D;
        boolean flag = false;

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

            if (entity1.canBeCollidedWith())
            {
                if (entity1 == this.field_184539_c)
                {
                    flag = true;
                }
                else if (this.ticksExisted < 2 && this.field_184539_c == null)
                {
                    this.field_184539_c = entity1;
                    flag = true;
                }
                else
                {
                    flag = false;
                    AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz(0.30000001192092896D);
                    RayTraceResult raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1);

                    if (raytraceresult1 != null)
                    {
                        double d1 = vec3d.squareDistanceTo(raytraceresult1.hitVec);

                        if (d1 < d0 || d0 == 0.0D)
                        {
                            entity = entity1;
                            d0 = d1;
                        }
                    }
                }
            }
        }

        if (this.field_184539_c != null)
        {
            if (flag)
            {
                this.field_184540_av = 2;
            }
            else if (this.field_184540_av-- <= 0)
            {
                this.field_184539_c = null;
            }
        }

        if (entity != null)
        {
            raytraceresult = new RayTraceResult(entity);
        }

 

My guess is the "entity" is sometimes the actual thrower.

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.



×
×
  • Create New...

Important Information

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