/// <summary>
        /// Returns whether an in-progress EntityAIBase should continue executing
        /// </summary>
        public override bool ContinueExecuting()
        {
            if (ScaredByPlayerMovement)
            {
                if (TemptedEntity.GetDistanceSqToEntity(TemptingPlayer) < 36D)
                {
                    if (TemptingPlayer.GetDistanceSq(Field_48276_c, Field_48273_d, Field_48274_e) > 0.010000000000000002F)
                    {
                        return(false);
                    }

                    if (Math.Abs((double)TemptingPlayer.RotationPitch - Field_48271_f) > 5D || Math.Abs((double)TemptingPlayer.RotationYaw - Field_48272_g) > 5D)
                    {
                        return(false);
                    }
                }
                else
                {
                    Field_48276_c = TemptingPlayer.PosX;
                    Field_48273_d = TemptingPlayer.PosY;
                    Field_48274_e = TemptingPlayer.PosZ;
                }

                Field_48271_f = TemptingPlayer.RotationPitch;
                Field_48272_g = TemptingPlayer.RotationYaw;
            }

            return(ShouldExecute());
        }
        /// <summary>
        /// Do not make give this method the name canInteractWith because it clashes with Container
        /// </summary>
        public virtual bool IsUseableByPlayer(EntityPlayer par1EntityPlayer)
        {
            if (WorldObj.GetBlockTileEntity(XCoord, YCoord, ZCoord) != this)
            {
                return(false);
            }

            return(par1EntityPlayer.GetDistanceSq(XCoord + 0.5F, YCoord + 0.5F, ZCoord + 0.5F) <= 64);
        }
Пример #3
0
        public override bool CanInteractWith(EntityPlayer par1EntityPlayer)
        {
            if (WorldPointer.GetBlockId(PosX, PosY, PosZ) != Block.EnchantmentTable.BlockID)
            {
                return(false);
            }

            return(par1EntityPlayer.GetDistanceSq(PosX + 0.5F, PosY + 0.5F, PosZ + 0.5F) <= 64);
        }