private void UpdatePushedObjects(float par1, float par2)
        {
            if (!Extending)
            {
                par1--;
            }
            else
            {
                par1 = 1.0F - par1;
            }

            AxisAlignedBB axisalignedbb = Block.PistonMoving.GetAxisAlignedBB(WorldObj, XCoord, YCoord, ZCoord, StoredBlockID, par1, StoredOrientation);

            if (axisalignedbb != null)
            {
                List <Entity> list = WorldObj.GetEntitiesWithinAABBExcludingEntity(null, axisalignedbb);

                if (list.Count > 0)
                {
                    PushedObjects.AddRange(list);
                    Entity entity;

                    for (IEnumerator <Entity> iterator = PushedObjects.GetEnumerator(); iterator.MoveNext(); entity.MoveEntity(par2 * (float)Facing.OffsetsXForSide[StoredOrientation], par2 * (float)Facing.OffsetsYForSide[StoredOrientation], par2 * (float)Facing.OffsetsZForSide[StoredOrientation]))
                    {
                        entity = iterator.Current;
                    }

                    PushedObjects.Clear();
                }
            }
        }
        /// <summary>
        /// Adds to the tesselator a box using the aabb for the bounds. Args: aabb
        /// </summary>
        public static void RenderAABB(AxisAlignedBB par0AxisAlignedBB)
        {
            Tessellator tessellator = Tessellator.Instance;

            tessellator.StartDrawingQuads();
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.Draw();
        }
        /// <summary>
        /// if instance and the argument bounding boxes overlap in the Y and X dimensions, calculate the offset between them
        /// in the Z dimension.  return var2 if the bounding boxes do not overlap or if var2 is closer to 0 then the
        /// calculated offset.  Otherwise return the calculated offset.
        /// </summary>
        public float CalculateZOffset(AxisAlignedBB par1AxisAlignedBB, float par2)
        {
            if (par1AxisAlignedBB.MaxX <= MinX || par1AxisAlignedBB.MinX >= MaxX)
            {
                return(par2);
            }

            if (par1AxisAlignedBB.MaxY <= MinY || par1AxisAlignedBB.MinY >= MaxY)
            {
                return(par2);
            }

            if (par2 > 0.0F && par1AxisAlignedBB.MaxZ <= MinZ)
            {
                float d = MinZ - par1AxisAlignedBB.MaxZ;

                if (d < par2)
                {
                    par2 = d;
                }
            }

            if (par2 < 0.0F && par1AxisAlignedBB.MinZ >= MaxZ)
            {
                float d1 = MaxZ - par1AxisAlignedBB.MinZ;

                if (d1 > par2)
                {
                    par2 = d1;
                }
            }

            return(par2);
        }
 /// <summary>
 /// Sets a new position for the renderer and setting it up so it can be reloaded with the new data for that position
 /// </summary>
 public void SetPosition(int par1, int par2, int par3)
 {
     if (par1 == PosX && par2 == PosY && par3 == PosZ)
     {
         return;
     }
     else
     {
         SetDontDraw();
         PosX      = par1;
         PosY      = par2;
         PosZ      = par3;
         PosXPlus  = par1 + 8;
         PosYPlus  = par2 + 8;
         PosZPlus  = par3 + 8;
         PosXClip  = par1 & 0x3ff;
         PosYClip  = par2;
         PosZClip  = par3 & 0x3ff;
         PosXMinus = par1 - PosXClip;
         PosYMinus = par2 - PosYClip;
         PosZMinus = par3 - PosZClip;
         float f = 6F;
         RendererBoundingBox = AxisAlignedBB.GetBoundingBox(par1 - f, par2 - f, par3 - f, (par1 + 16) + f, (par2 + 16) + f, (par3 + 16) + f);
         //GL.NewList(GlRenderList + 2, ListMode.Compile);
         RenderItem.RenderAABB(AxisAlignedBB.GetBoundingBoxFromPool(PosXClip - f, PosYClip - f, PosZClip - f, (PosXClip + 16) + f, (PosYClip + 16) + f, (PosZClip + 16) + f));
         //GL.EndList();
         MarkDirty();
         return;
     }
 }
 /// <summary>
 /// Sets the bounding box to the same bounds as the bounding box passed in. Args: axisAlignedBB
 /// </summary>
 public void SetBB(AxisAlignedBB par1AxisAlignedBB)
 {
     MinX = par1AxisAlignedBB.MinX;
     MinY = par1AxisAlignedBB.MinY;
     MinZ = par1AxisAlignedBB.MinZ;
     MaxX = par1AxisAlignedBB.MaxX;
     MaxY = par1AxisAlignedBB.MaxY;
     MaxZ = par1AxisAlignedBB.MaxZ;
 }
        /// <summary>
        /// Called when the throwable hits a block or entity.
        /// </summary>
        protected override void OnImpact(MovingObjectPosition par1MovingObjectPosition)
        {
            if (!WorldObj.IsRemote)
            {
                List <PotionEffect> list = Item.Potion.GetEffects(PotionDamage);

                if (list != null && list.Count > 0)
                {
                    AxisAlignedBB axisalignedbb = BoundingBox.Expand(4, 2, 4);
                    List <Entity> list1         = WorldObj.GetEntitiesWithinAABB(typeof(net.minecraft.src.EntityLiving), axisalignedbb);

                    if (list1 != null && list1.Count > 0)
                    {
                        for (IEnumerator <Entity> iterator = list1.GetEnumerator(); iterator.MoveNext();)
                        {
                            Entity entity = iterator.Current;
                            double d      = GetDistanceSqToEntity(entity);

                            if (d < 16D)
                            {
                                double d1 = 1.0D - Math.Sqrt(d) / 4D;

                                if (entity == par1MovingObjectPosition.EntityHit)
                                {
                                    d1 = 1.0D;
                                }

                                IEnumerator <PotionEffect> iterator1 = list.GetEnumerator();

                                while (iterator1.MoveNext())
                                {
                                    PotionEffect potioneffect = iterator1.Current;
                                    int          i            = potioneffect.GetPotionID();

                                    if (Potion.PotionTypes[i].IsInstant())
                                    {
                                        Potion.PotionTypes[i].AffectEntity(Thrower, (EntityLiving)entity, potioneffect.GetAmplifier(), d1);
                                    }
                                    else
                                    {
                                        int j = (int)(d1 * (double)potioneffect.GetDuration() + 0.5D);

                                        if (j > 20)
                                        {
                                            ((EntityLiving)entity).AddPotionEffect(new PotionEffect(i, j, potioneffect.GetAmplifier()));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                WorldObj.PlayAuxSFX(2002, (int)Math.Round(PosX), (int)Math.Round(PosY), (int)Math.Round(PosZ), PotionDamage);
                SetDead();
            }
        }
Exemple #7
0
        /// <summary>
        /// Returns the bounding box of the wired rectangular prism to render.
        /// </summary>
        public override AxisAlignedBB GetSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
        {
            int   i  = par1World.GetBlockMetadata(par2, par3, par4);
            float f  = 0.0625F;
            float f1 = (float)(1 + i * 2) / 16F;
            float f2 = 0.5F;

            return(AxisAlignedBB.GetBoundingBoxFromPool((float)par2 + f1, par3, (float)par4 + f, (float)(par2 + 1) - f, (float)par3 + f2, (float)(par4 + 1) - f));
        }
        /// <summary>
        /// Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
        /// cleared to be reused)
        /// </summary>
        public override AxisAlignedBB GetCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
        {
            int i = par1World.GetBlockMetadata(par2, par3, par4) & 7;

            if (i >= 3)
            {
                return(AxisAlignedBB.GetBoundingBoxFromPool(par2 + MinX, par3 + MinY, par4 + MinZ, par2 + MaxX, par3 + 0.5F, par4 + MaxZ));
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Returns whether the given bounding box intersects with this one. Args: axisAlignedBB
        /// </summary>
        public bool IntersectsWith(AxisAlignedBB par1AxisAlignedBB)
        {
            if (par1AxisAlignedBB.MaxX <= MinX || par1AxisAlignedBB.MinX >= MaxX)
            {
                return(false);
            }

            if (par1AxisAlignedBB.MaxY <= MinY || par1AxisAlignedBB.MinY >= MaxY)
            {
                return(false);
            }

            return(par1AxisAlignedBB.MaxZ > MinZ && par1AxisAlignedBB.MinZ < MaxZ);
        }
        /// <summary>
        /// Checks if there are mobs on the plate. If a mob is on the plate and it is off, it turns it on, and vice versa.
        /// </summary>
        private void SetStateIfMobInteractsWithPlate(World par1World, int par2, int par3, int par4)
        {
            bool          flag  = par1World.GetBlockMetadata(par2, par3, par4) == 1;
            bool          flag1 = false;
            float         f     = 0.125F;
            List <Entity> list  = null;

            if (TriggerMobType == EnumMobType.everything)
            {
                list = par1World.GetEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.GetBoundingBoxFromPool(par2 + f, par3, par4 + f, (par2 + 1) - f, par3 + 0.25F, (par4 + 1) - f));
            }

            if (TriggerMobType == EnumMobType.mobs)
            {
                list = par1World.GetEntitiesWithinAABB(typeof(net.minecraft.src.EntityLiving), AxisAlignedBB.GetBoundingBoxFromPool(par2 + f, par3, par4 + f, (par2 + 1) - f, par3 + 0.25F, (par4 + 1) - f));
            }

            if (TriggerMobType == EnumMobType.players)
            {
                list = par1World.GetEntitiesWithinAABB(typeof(net.minecraft.src.EntityPlayer), AxisAlignedBB.GetBoundingBoxFromPool(par2 + f, par3, par4 + f, (par2 + 1) - f, par3 + 0.25F, (par4 + 1) - f));
            }

            if (list.Count > 0)
            {
                flag1 = true;
            }

            if (flag1 && !flag)
            {
                par1World.SetBlockMetadataWithNotify(par2, par3, par4, 1);
                par1World.NotifyBlocksOfNeighborChange(par2, par3, par4, BlockID);
                par1World.NotifyBlocksOfNeighborChange(par2, par3 - 1, par4, BlockID);
                par1World.MarkBlocksDirty(par2, par3, par4, par2, par3, par4);
                par1World.PlaySoundEffect((double)par2 + 0.5D, (double)par3 + 0.10000000000000001D, (double)par4 + 0.5D, "random.click", 0.3F, 0.6F);
            }

            if (!flag1 && flag)
            {
                par1World.SetBlockMetadataWithNotify(par2, par3, par4, 0);
                par1World.NotifyBlocksOfNeighborChange(par2, par3, par4, BlockID);
                par1World.NotifyBlocksOfNeighborChange(par2, par3 - 1, par4, BlockID);
                par1World.MarkBlocksDirty(par2, par3, par4, par2, par3, par4);
                par1World.PlaySoundEffect((double)par2 + 0.5D, (double)par3 + 0.10000000000000001D, (double)par4 + 0.5D, "random.click", 0.3F, 0.5F);
            }

            if (flag1)
            {
                par1World.ScheduleBlockUpdate(par2, par3, par4, BlockID, TickRate());
            }
        }
Exemple #11
0
        /// <summary>
        /// Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity
        /// Args: entity, aabb, listToFill
        /// </summary>
        public virtual void GetEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List <Entity> par3List)
        {
            int i = MathHelper2.Floor_double((par2AxisAlignedBB.MinY - 2D) / 16D);
            int j = MathHelper2.Floor_double((par2AxisAlignedBB.MaxY + 2D) / 16D);

            if (i < 0)
            {
                i = 0;
            }

            if (j >= EntityLists.Length)
            {
                j = EntityLists.Length - 1;
            }

            for (int k = i; k <= j; k++)
            {
                List <Entity> list = EntityLists[k];

                for (int l = 0; l < list.Count; l++)
                {
                    Entity entity = list[l];

                    if (entity == par1Entity || !entity.BoundingBox.IntersectsWith(par2AxisAlignedBB))
                    {
                        continue;
                    }

                    par3List.Add(entity);
                    Entity[] aentity = entity.GetParts();

                    if (aentity == null)
                    {
                        continue;
                    }

                    for (int i1 = 0; i1 < aentity.Length; i1++)
                    {
                        Entity entity1 = aentity[i1];

                        if (entity1 != par1Entity && entity1.BoundingBox.IntersectsWith(par2AxisAlignedBB))
                        {
                            par3List.Add(entity1);
                        }
                    }
                }
            }
        }
Exemple #12
0
        /// <summary>
        /// Destroys all blocks that aren't associated with 'The End' inside the given bounding box.
        /// </summary>
        private bool DestroyBlocksInAABB(AxisAlignedBB par1AxisAlignedBB)
        {
            int  i     = MathHelper2.Floor_double(par1AxisAlignedBB.MinX);
            int  j     = MathHelper2.Floor_double(par1AxisAlignedBB.MinY);
            int  k     = MathHelper2.Floor_double(par1AxisAlignedBB.MinZ);
            int  l     = MathHelper2.Floor_double(par1AxisAlignedBB.MaxX);
            int  i1    = MathHelper2.Floor_double(par1AxisAlignedBB.MaxY);
            int  j1    = MathHelper2.Floor_double(par1AxisAlignedBB.MaxZ);
            bool flag  = false;
            bool flag1 = false;

            for (int k1 = i; k1 <= l; k1++)
            {
                for (int l1 = j; l1 <= i1; l1++)
                {
                    for (int i2 = k; i2 <= j1; i2++)
                    {
                        int j2 = WorldObj.GetBlockId(k1, l1, i2);

                        if (j2 == 0)
                        {
                            continue;
                        }

                        if (j2 == Block.Obsidian.BlockID || j2 == Block.WhiteStone.BlockID || j2 == Block.Bedrock.BlockID)
                        {
                            flag = true;
                        }
                        else
                        {
                            flag1 = true;
                            WorldObj.SetBlockWithNotify(k1, l1, i2, 0);
                        }
                    }
                }
            }

            if (flag1)
            {
                double d  = par1AxisAlignedBB.MinX + (par1AxisAlignedBB.MaxX - par1AxisAlignedBB.MinX) * (double)Rand.NextFloat();
                double d1 = par1AxisAlignedBB.MinY + (par1AxisAlignedBB.MaxY - par1AxisAlignedBB.MinY) * (double)Rand.NextFloat();
                double d2 = par1AxisAlignedBB.MinZ + (par1AxisAlignedBB.MaxZ - par1AxisAlignedBB.MinZ) * (double)Rand.NextFloat();
                WorldObj.SpawnParticle("largeexplode", d, d1, d2, 0.0F, 0.0F, 0.0F);
            }

            return(flag);
        }
        public virtual AxisAlignedBB GetAxisAlignedBB(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
        {
            if (par5 == 0 || par5 == BlockID)
            {
                return(null);
            }

            AxisAlignedBB axisalignedbb = Block.BlocksList[par5].GetCollisionBoundingBoxFromPool(par1World, par2, par3, par4);

            if (axisalignedbb == null)
            {
                return(null);
            }

            if (Facing.OffsetsXForSide[par7] < 0)
            {
                axisalignedbb.MinX -= (float)Facing.OffsetsXForSide[par7] * par6;
            }
            else
            {
                axisalignedbb.MaxX -= (float)Facing.OffsetsXForSide[par7] * par6;
            }

            if (Facing.OffsetsYForSide[par7] < 0)
            {
                axisalignedbb.MinY -= (float)Facing.OffsetsYForSide[par7] * par6;
            }
            else
            {
                axisalignedbb.MaxY -= (float)Facing.OffsetsYForSide[par7] * par6;
            }

            if (Facing.OffsetsZForSide[par7] < 0)
            {
                axisalignedbb.MinZ -= (float)Facing.OffsetsZForSide[par7] * par6;
            }
            else
            {
                axisalignedbb.MaxZ -= (float)Facing.OffsetsZForSide[par7] * par6;
            }

            return(axisalignedbb);
        }
        /// <summary>
        /// True if the ghast has an unobstructed line of travel to the waypoint.
        /// </summary>
        private bool IsCourseTraversable(float par1, float par3, float par5, float par7)
        {
            float         d             = (WaypointX - PosX) / par7;
            float         d1            = (WaypointY - PosY) / par7;
            float         d2            = (WaypointZ - PosZ) / par7;
            AxisAlignedBB axisalignedbb = BoundingBox.Copy();

            for (int i = 1; i < par7; i++)
            {
                axisalignedbb.Offset(d, d1, d2);

                if (WorldObj.GetCollidingBoundingBoxes(this, axisalignedbb).Count > 0)
                {
                    return(false);
                }
            }

            return(true);
        }
        /// <summary>
        /// Renders a white box with the bounds of the AABB translated by the offset. Args: aabb, x, y, z
        /// </summary>
        public static void RenderOffsetAABB(AxisAlignedBB par0AxisAlignedBB, double par1, double par3, double par5)
        {
            //GL.Disable(EnableCap.Texture2D);
            Tessellator tessellator = Tessellator.Instance;

            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            tessellator.StartDrawingQuads();
            tessellator.SetTranslation(par1, par3, par5);
            tessellator.SetNormal(0.0F, 0.0F, -1F);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.SetNormal(0.0F, 0.0F, 1.0F);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.SetNormal(0.0F, -1F, 0.0F);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.SetNormal(0.0F, 1.0F, 0.0F);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.SetNormal(-1F, 0.0F, 0.0F);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MinX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.SetNormal(1.0F, 0.0F, 0.0F);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MinZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MaxY, par0AxisAlignedBB.MaxZ);
            tessellator.AddVertex(par0AxisAlignedBB.MaxX, par0AxisAlignedBB.MinY, par0AxisAlignedBB.MaxZ);
            tessellator.SetTranslation(0.0F, 0.0F, 0.0F);
            tessellator.Draw();
            //GL.Enable(EnableCap.Texture2D);
        }
Exemple #16
0
        /// <summary>
        /// Gets all entities that can be assigned to the specified class. Args: entityClass, aabb, listToFill
        /// </summary>
        public virtual void GetEntitiesOfTypeWithinAAAB(Type par1Class, AxisAlignedBB par2AxisAlignedBB, List <Entity> par3List)
        {
            int i = MathHelper2.Floor_double((par2AxisAlignedBB.MinY - 2D) / 16D);
            int j = MathHelper2.Floor_double((par2AxisAlignedBB.MaxY + 2D) / 16D);

            if (i < 0)
            {
                i = 0;
            }
            else if (i >= EntityLists.Length)
            {
                i = EntityLists.Length - 1;
            }

            if (j >= EntityLists.Length)
            {
                j = EntityLists.Length - 1;
            }
            else if (j < 0)
            {
                j = 0;
            }

            for (int k = i; k <= j; k++)
            {
                List <Entity> list = EntityLists[k];

                for (int l = 0; l < list.Count; l++)
                {
                    Entity entity = list[l];

                    if (par1Class.IsAssignableFrom(entity.GetType()) && entity.BoundingBox.IntersectsWith(par2AxisAlignedBB))
                    {
                        par3List.Add(entity);
                    }
                }
            }
        }
        /// <summary>
        /// Adds to the supplied array any colliding bounding boxes with the passed in bounding box. Args: world, x, y, z,
        /// axisAlignedBB, arrayList
        /// </summary>
        public override void GetCollidingBoundingBoxes(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List <AxisAlignedBB> par6ArrayList)
        {
            SetBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F);
            base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
            float f = 0.125F;

            SetBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
            base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
            SetBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
            base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
            SetBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
            base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
            SetBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
            base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
            SetBlockBoundsForItemRender();
        }
        /// <summary>
        /// Adds to the supplied array any colliding bounding boxes with the passed in bounding box. Args: world, x, y, z,
        /// axisAlignedBB, arrayList
        /// </summary>
        public override void GetCollidingBoundingBoxes(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List <AxisAlignedBB> par6ArrayList)
        {
            int   i  = par1World.GetBlockMetadata(par2, par3, par4);
            int   j  = i & 3;
            float f  = 0.0F;
            float f1 = 0.5F;
            float f2 = 0.5F;
            float f3 = 1.0F;

            if ((i & 4) != 0)
            {
                f  = 0.5F;
                f1 = 1.0F;
                f2 = 0.0F;
                f3 = 0.5F;
            }

            SetBlockBounds(0.0F, f, 0.0F, 1.0F, f1, 1.0F);
            base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);

            if (j == 0)
            {
                SetBlockBounds(0.5F, f2, 0.0F, 1.0F, f3, 1.0F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
            }
            else if (j == 1)
            {
                SetBlockBounds(0.0F, f2, 0.0F, 0.5F, f3, 1.0F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
            }
            else if (j == 2)
            {
                SetBlockBounds(0.0F, f2, 0.5F, 1.0F, f3, 1.0F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
            }
            else if (j == 3)
            {
                SetBlockBounds(0.0F, f2, 0.0F, 1.0F, f3, 0.5F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
            }

            SetBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        }
 /// <summary>
 /// Adds to the supplied array any colliding bounding boxes with the passed in bounding box. Args: world, x, y, z,
 /// axisAlignedBB, arrayList
 /// </summary>
 public override void GetCollidingBoundingBoxes(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List <AxisAlignedBB> par6ArrayList)
 {
     SetBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F);
     base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
     SetBlockBoundsForItemRender();
     base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
 }
        private static bool Func_50075_j(World par0World, int par1, int par2, int par3)
        {
            for (IEnumerator <Entity> iterator = par0World.GetEntitiesWithinAABB(typeof(net.minecraft.src.EntityOcelot), AxisAlignedBB.GetBoundingBoxFromPool(par1, par2 + 1, par3, par1 + 1, par2 + 2, par3 + 1)).GetEnumerator(); iterator.MoveNext();)
            {
                Entity       entity       = iterator.Current;
                EntityOcelot entityocelot = (EntityOcelot)entity;

                if (entityocelot.IsSitting())
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #21
0
        /// <summary>
        /// Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
        /// </summary>
        public override ItemStack OnItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
        {
            float  f      = 1.0F;
            float  f1     = par3EntityPlayer.PrevRotationPitch + (par3EntityPlayer.RotationPitch - par3EntityPlayer.PrevRotationPitch) * f;
            float  f2     = par3EntityPlayer.PrevRotationYaw + (par3EntityPlayer.RotationYaw - par3EntityPlayer.PrevRotationYaw) * f;
            double d      = par3EntityPlayer.PrevPosX + (par3EntityPlayer.PosX - par3EntityPlayer.PrevPosX) * (double)f;
            double d1     = (par3EntityPlayer.PrevPosY + (par3EntityPlayer.PosY - par3EntityPlayer.PrevPosY) * (double)f + 1.6200000000000001D) - (double)par3EntityPlayer.YOffset;
            double d2     = par3EntityPlayer.PrevPosZ + (par3EntityPlayer.PosZ - par3EntityPlayer.PrevPosZ) * (double)f;
            Vec3D  vec3d  = Vec3D.CreateVector(d, d1, d2);
            float  f3     = MathHelper2.Cos(-f2 * 0.01745329F - (float)Math.PI);
            float  f4     = MathHelper2.Sin(-f2 * 0.01745329F - (float)Math.PI);
            float  f5     = -MathHelper2.Cos(-f1 * 0.01745329F);
            float  f6     = MathHelper2.Sin(-f1 * 0.01745329F);
            float  f7     = f4 * f5;
            float  f8     = f6;
            float  f9     = f3 * f5;
            float  d3     = 5;
            Vec3D  vec3d1 = vec3d.AddVector((double)f7 * d3, (double)f8 * d3, (double)f9 * d3);
            MovingObjectPosition movingobjectposition = par2World.RayTraceBlocks_do(vec3d, vec3d1, true);

            if (movingobjectposition == null)
            {
                return(par1ItemStack);
            }

            Vec3D         vec3d2 = par3EntityPlayer.GetLook(f);
            bool          flag   = false;
            float         f10    = 1.0F;
            List <Entity> list   = par2World.GetEntitiesWithinAABBExcludingEntity(par3EntityPlayer, par3EntityPlayer.BoundingBox.AddCoord((float)vec3d2.XCoord * d3, (float)vec3d2.YCoord * d3, (float)vec3d2.ZCoord * d3).Expand(f10, f10, f10));

            for (int l = 0; l < list.Count; l++)
            {
                Entity entity = list[l];

                if (!entity.CanBeCollidedWith())
                {
                    continue;
                }

                float         f11           = entity.GetCollisionBorderSize();
                AxisAlignedBB axisalignedbb = entity.BoundingBox.Expand(f11, f11, f11);

                if (axisalignedbb.IsVecInside(vec3d))
                {
                    flag = true;
                }
            }

            if (flag)
            {
                return(par1ItemStack);
            }

            if (movingobjectposition.TypeOfHit == EnumMovingObjectType.TILE)
            {
                int i = movingobjectposition.BlockX;
                int j = movingobjectposition.BlockY;
                int k = movingobjectposition.BlockZ;

                if (!par2World.IsRemote)
                {
                    if (par2World.GetBlockId(i, j, k) == Block.Snow.BlockID)
                    {
                        j--;
                    }

                    par2World.SpawnEntityInWorld(new EntityBoat(par2World, (float)i + 0.5F, (float)j + 1.0F, (float)k + 0.5F));
                }

                if (!par3EntityPlayer.Capabilities.IsCreativeMode)
                {
                    par1ItemStack.StackSize--;
                }
            }

            return(par1ItemStack);
        }
Exemple #22
0
 /// <summary>
 /// Gets all entities that can be assigned to the specified class. Args: entityClass, aabb, listToFill
 /// </summary>
 public override void GetEntitiesOfTypeWithinAAAB(Type class1, AxisAlignedBB axisalignedbb, List <Entity> list)
 {
 }
        /// <summary>
        /// Returns the bounding box of the wired rectangular prism to render.
        /// </summary>
        public override AxisAlignedBB GetSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
        {
            float f = 0.0625F;

            return(AxisAlignedBB.GetBoundingBoxFromPool((float)par2 + f, par3, (float)par4 + f, (float)(par2 + 1) - f, par3 + 1, (float)(par4 + 1) - f));
        }
 /// <summary>
 /// Adds to the supplied array any colliding bounding boxes with the passed in bounding box. Args: world, x, y, z,
 /// axisAlignedBB, arrayList
 /// </summary>
 public override void GetCollidingBoundingBoxes(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List <AxisAlignedBB> par6ArrayList)
 {
     SetBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
     base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
 }
 /// <summary>
 /// Adds to the supplied array any colliding bounding boxes with the passed in bounding box. Args: world, x, y, z,
 /// axisAlignedBB, arrayList
 /// </summary>
 public override void GetCollidingBoundingBoxes(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List <AxisAlignedBB> arraylist)
 {
 }
        /// <summary>
        /// Adds to the supplied array any colliding bounding boxes with the passed in bounding box. Args: world, x, y, z,
        /// axisAlignedBB, arrayList
        /// </summary>
        public override void GetCollidingBoundingBoxes(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List <AxisAlignedBB> par6ArrayList)
        {
            int i = par1World.GetBlockMetadata(par2, par3, par4);

            switch (GetDirectionMeta(i))
            {
            case 0:
                SetBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                SetBlockBounds(0.375F, 0.25F, 0.375F, 0.625F, 1.0F, 0.625F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                break;

            case 1:
                SetBlockBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                SetBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 0.75F, 0.625F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                break;

            case 2:
                SetBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                SetBlockBounds(0.25F, 0.375F, 0.25F, 0.75F, 0.625F, 1.0F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                break;

            case 3:
                SetBlockBounds(0.0F, 0.0F, 0.75F, 1.0F, 1.0F, 1.0F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                SetBlockBounds(0.25F, 0.375F, 0.0F, 0.75F, 0.625F, 0.75F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                break;

            case 4:
                SetBlockBounds(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                SetBlockBounds(0.375F, 0.25F, 0.25F, 0.625F, 0.75F, 1.0F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                break;

            case 5:
                SetBlockBounds(0.75F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                SetBlockBounds(0.0F, 0.375F, 0.25F, 0.75F, 0.625F, 0.75F);
                base.GetCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList);
                break;
            }

            SetBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        }
Exemple #27
0
 /// <summary>
 /// Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity
 /// Args: entity, aabb, listToFill
 /// </summary>
 public override void GetEntitiesWithinAABBForEntity(Entity entity, AxisAlignedBB axisalignedbb, List <Entity> list)
 {
 }
        /// <summary>
        /// Called to update the entity's position/logic.
        /// </summary>
        public override void OnUpdate()
        {
            LastTickPosX = PosX;
            LastTickPosY = PosY;
            LastTickPosZ = PosZ;
            base.OnUpdate();

            if (ThrowableShake > 0)
            {
                ThrowableShake--;
            }

            if (InGround)
            {
                int i = WorldObj.GetBlockId(XTile, YTile, ZTile);

                if (i != InTile)
                {
                    InGround      = false;
                    MotionX      *= Rand.NextFloat() * 0.2F;
                    MotionY      *= Rand.NextFloat() * 0.2F;
                    MotionZ      *= Rand.NextFloat() * 0.2F;
                    TicksInGround = 0;
                    TicksInAir    = 0;
                }
                else
                {
                    TicksInGround++;

                    if (TicksInGround == 1200)
                    {
                        SetDead();
                    }

                    return;
                }
            }
            else
            {
                TicksInAir++;
            }

            Vec3D vec3d  = Vec3D.CreateVector(PosX, PosY, PosZ);
            Vec3D vec3d1 = Vec3D.CreateVector(PosX + MotionX, PosY + MotionY, PosZ + MotionZ);
            MovingObjectPosition movingobjectposition = WorldObj.RayTraceBlocks(vec3d, vec3d1);

            vec3d  = Vec3D.CreateVector(PosX, PosY, PosZ);
            vec3d1 = Vec3D.CreateVector(PosX + MotionX, PosY + MotionY, PosZ + MotionZ);

            if (movingobjectposition != null)
            {
                vec3d1 = Vec3D.CreateVector(movingobjectposition.HitVec.XCoord, movingobjectposition.HitVec.YCoord, movingobjectposition.HitVec.ZCoord);
            }

            if (!WorldObj.IsRemote)
            {
                Entity        entity = null;
                List <Entity> list   = WorldObj.GetEntitiesWithinAABBExcludingEntity(this, BoundingBox.AddCoord(MotionX, MotionY, MotionZ).Expand(1.0F, 1.0F, 1.0F));
                float         d      = 0.0F;

                for (int k = 0; k < list.Count; k++)
                {
                    Entity entity1 = list[k];

                    if (!entity1.CanBeCollidedWith() || entity1 == Thrower && TicksInAir < 5)
                    {
                        continue;
                    }

                    float                f4                    = 0.3F;
                    AxisAlignedBB        axisalignedbb         = entity1.BoundingBox.Expand(f4, f4, f4);
                    MovingObjectPosition movingobjectposition1 = axisalignedbb.CalculateIntercept(vec3d, vec3d1);

                    if (movingobjectposition1 == null)
                    {
                        continue;
                    }

                    float d1 = (float)vec3d.DistanceTo(movingobjectposition1.HitVec);

                    if (d1 < d || d == 0.0F)
                    {
                        entity = entity1;
                        d      = d1;
                    }
                }

                if (entity != null)
                {
                    movingobjectposition = new MovingObjectPosition(entity);
                }
            }

            if (movingobjectposition != null)
            {
                OnImpact(movingobjectposition);
            }

            PosX += MotionX;
            PosY += MotionY;
            PosZ += MotionZ;
            float f = MathHelper2.Sqrt_double(MotionX * MotionX + MotionZ * MotionZ);

            RotationYaw = (float)((Math.Atan2(MotionX, MotionZ) * 180D) / Math.PI);

            for (RotationPitch = (float)((Math.Atan2(MotionY, f) * 180D) / Math.PI); RotationPitch - PrevRotationPitch < -180F; PrevRotationPitch -= 360F)
            {
            }

            for (; RotationPitch - PrevRotationPitch >= 180F; PrevRotationPitch += 360F)
            {
            }

            for (; RotationYaw - PrevRotationYaw < -180F; PrevRotationYaw -= 360F)
            {
            }

            for (; RotationYaw - PrevRotationYaw >= 180F; PrevRotationYaw += 360F)
            {
            }

            RotationPitch = PrevRotationPitch + (RotationPitch - PrevRotationPitch) * 0.2F;
            RotationYaw   = PrevRotationYaw + (RotationYaw - PrevRotationYaw) * 0.2F;
            float f1 = 0.99F;
            float f2 = Func_40075_e();

            if (IsInWater())
            {
                for (int j = 0; j < 4; j++)
                {
                    float f3 = 0.25F;
                    WorldObj.SpawnParticle("bubble", PosX - MotionX * f3, PosY - MotionY * f3, PosZ - MotionZ * f3, MotionX, MotionY, MotionZ);
                }

                f1 = 0.8F;
            }

            MotionX *= f1;
            MotionY *= f1;
            MotionZ *= f1;
            MotionY -= f2;
            SetPosition(PosX, PosY, PosZ);
        }
Exemple #29
0
        /// <summary>
        /// Called to update the entity's position/logic.
        /// </summary>
        public override void OnUpdate()
        {
            base.OnUpdate();

            if (LightningState == 2)
            {
                WorldObj.PlaySoundEffect(PosX, PosY, PosZ, "ambient.weather.thunder", 10000F, 0.8F + Rand.NextFloat() * 0.2F);
                WorldObj.PlaySoundEffect(PosX, PosY, PosZ, "random.explode", 2.0F, 0.5F + Rand.NextFloat() * 0.2F);
            }

            LightningState--;

            if (LightningState < 0)
            {
                if (BoltLivingTime == 0)
                {
                    SetDead();
                }
                else if (LightningState < -Rand.Next(10))
                {
                    BoltLivingTime--;
                    LightningState = 1;
                    BoltVertex     = Rand.Next();

                    if (WorldObj.DoChunksNearChunkExist(MathHelper2.Floor_double(PosX), MathHelper2.Floor_double(PosY), MathHelper2.Floor_double(PosZ), 10))
                    {
                        int i = MathHelper2.Floor_double(PosX);
                        int j = MathHelper2.Floor_double(PosY);
                        int k = MathHelper2.Floor_double(PosZ);

                        if (WorldObj.GetBlockId(i, j, k) == 0 && Block.Fire.CanPlaceBlockAt(WorldObj, i, j, k))
                        {
                            WorldObj.SetBlockWithNotify(i, j, k, Block.Fire.BlockID);
                        }
                    }
                }
            }

            if (LightningState >= 0)
            {
                float         d    = 3;
                List <Entity> list = WorldObj.GetEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.GetBoundingBoxFromPool(PosX - d, PosY - d, PosZ - d, PosX + d, PosY + 6 + d, PosZ + d));

                for (int l = 0; l < list.Count; l++)
                {
                    Entity entity = list[l];
                    entity.OnStruckByLightning(this);
                }

                WorldObj.LightningFlash = 2;
            }
        }
Exemple #30
0
        /// <summary>
        /// Called to update the entity's position/logic.
        /// </summary>
        public override void OnUpdate()
        {
            if (!WorldObj.IsRemote && (ShootingEntity != null && ShootingEntity.IsDead || !WorldObj.BlockExists((int)PosX, (int)PosY, (int)PosZ)))
            {
                SetDead();
                return;
            }

            base.OnUpdate();
            SetFire(1);

            if (InGround)
            {
                int i = WorldObj.GetBlockId(XTile, YTile, ZTile);

                if (i != InTile)
                {
                    InGround   = false;
                    MotionX   *= Rand.NextFloat() * 0.2F;
                    MotionY   *= Rand.NextFloat() * 0.2F;
                    MotionZ   *= Rand.NextFloat() * 0.2F;
                    TicksAlive = 0;
                    TicksInAir = 0;
                }
                else
                {
                    TicksAlive++;

                    if (TicksAlive == 600)
                    {
                        SetDead();
                    }

                    return;
                }
            }
            else
            {
                TicksInAir++;
            }

            Vec3D vec3d  = Vec3D.CreateVector(PosX, PosY, PosZ);
            Vec3D vec3d1 = Vec3D.CreateVector(PosX + MotionX, PosY + MotionY, PosZ + MotionZ);
            MovingObjectPosition movingobjectposition = WorldObj.RayTraceBlocks(vec3d, vec3d1);

            vec3d  = Vec3D.CreateVector(PosX, PosY, PosZ);
            vec3d1 = Vec3D.CreateVector(PosX + MotionX, PosY + MotionY, PosZ + MotionZ);

            if (movingobjectposition != null)
            {
                vec3d1 = Vec3D.CreateVector(movingobjectposition.HitVec.XCoord, movingobjectposition.HitVec.YCoord, movingobjectposition.HitVec.ZCoord);
            }

            Entity        entity = null;
            List <Entity> list   = WorldObj.GetEntitiesWithinAABBExcludingEntity(this, BoundingBox.AddCoord(MotionX, MotionY, MotionZ).Expand(1.0F, 1.0F, 1.0F));
            double        d      = 0.0F;

            for (int j = 0; j < list.Count; j++)
            {
                Entity entity1 = list[j];

                if (!entity1.CanBeCollidedWith() || entity1.IsEntityEqual(ShootingEntity) && TicksInAir < 25)
                {
                    continue;
                }

                float                f2                    = 0.3F;
                AxisAlignedBB        axisalignedbb         = entity1.BoundingBox.Expand(f2, f2, f2);
                MovingObjectPosition movingobjectposition1 = axisalignedbb.CalculateIntercept(vec3d, vec3d1);

                if (movingobjectposition1 == null)
                {
                    continue;
                }

                double d1 = vec3d.DistanceTo(movingobjectposition1.HitVec);

                if (d1 < d || d == 0.0F)
                {
                    entity = entity1;
                    d      = d1;
                }
            }

            if (entity != null)
            {
                movingobjectposition = new MovingObjectPosition(entity);
            }

            if (movingobjectposition != null)
            {
                Func_40071_a(movingobjectposition);
            }

            PosX += MotionX;
            PosY += MotionY;
            PosZ += MotionZ;
            float f = MathHelper2.Sqrt_double(MotionX * MotionX + MotionZ * MotionZ);

            RotationYaw = (float)((Math.Atan2(MotionX, MotionZ) * 180D) / Math.PI);

            for (RotationPitch = (float)((Math.Atan2(MotionY, f) * 180D) / Math.PI); RotationPitch - PrevRotationPitch < -180F; PrevRotationPitch -= 360F)
            {
            }

            for (; RotationPitch - PrevRotationPitch >= 180F; PrevRotationPitch += 360F)
            {
            }

            for (; RotationYaw - PrevRotationYaw < -180F; PrevRotationYaw -= 360F)
            {
            }

            for (; RotationYaw - PrevRotationYaw >= 180F; PrevRotationYaw += 360F)
            {
            }

            RotationPitch = PrevRotationPitch + (RotationPitch - PrevRotationPitch) * 0.2F;
            RotationYaw   = PrevRotationYaw + (RotationYaw - PrevRotationYaw) * 0.2F;
            float f1 = 0.95F;

            if (IsInWater())
            {
                for (int k = 0; k < 4; k++)
                {
                    float f3 = 0.25F;
                    WorldObj.SpawnParticle("bubble", PosX - MotionX * (double)f3, PosY - MotionY * (double)f3, PosZ - MotionZ * (double)f3, MotionX, MotionY, MotionZ);
                }

                f1 = 0.8F;
            }

            MotionX += AccelerationX;
            MotionY += AccelerationY;
            MotionZ += AccelerationZ;
            MotionX *= f1;
            MotionY *= f1;
            MotionZ *= f1;
            WorldObj.SpawnParticle("smoke", PosX, PosY + 0.5D, PosZ, 0.0F, 0.0F, 0.0F);
            SetPosition(PosX, PosY, PosZ);
        }